Non ambigous Argmuent and Flag position #581
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Let's take
abra app cmd
as an example, since we also have a real problem hereCurrently the command usage is advertised the following:
So I can run the following:
But it is also possible to set [command options] after the like this:
This behaviour was explicitly restored in this commit
0e688f1407
by downgrading our cli libraryurfave/cli
from v2 to v1.This had the consequence, that the following does not work anymore:
I prose to upgrade
urfave/cli
back to v2 and there only allow command options directly after the command as it is also currently advertised.In coop-cloud/abra#404 i implemented the upgrade, whats left is fixing all option usages in the integration tests. If accepted I am willing to do the rest of the work.
@p4u1 thanks for raising.
@3wordchant any thoughts?
My vote does not matter much (given I have zero deployments atm), but in terms of general codebase health- I thinking upgrading to
urfave/cli#v2
is best. Release ofv2.27.1
was in Dec, 2023 containing over 5 years and 100 smaller releases with what looks like many fixes and small improvements. They're already working on av3.
releases ofcli
🤯I have no idea how much this will screw up people's deployments and flows. Objectively speaking, I think this makes a truckload 🚚 🧠 more sense for the a longer term health of
abra
and Co-op Cloud to upgrade.Additional data points:
From what I can remember in #284, we were forced in v2 to put
[command options]
only before the<command>
and this was causing people issues. This is not "only allow command options directly after the command" @p4u1?I've just built a local copy of coop-cloud/abra#404 and this is still the case:
I'm very confused again.
Annnnd this: coop-cloud/organising#361
@p4u1 v3 upgrade spike? 😱
Update: we're leaving this in the new release as it's not a new regression and the fix for it needs some serious work. It's a rather minor bug which at least @moritz was able to figure out how to make work... very not ideal but we're so far behind on this release work, it seems like the best way forward now.
decentral1se referenced this issue2024-03-12 09:40:32 +00:00
Maybe a survey of other CLI tools which support multiple word commands, to see which of them have restrictions on option placement, could be useful? And/or some UX testing on this?
In the mean-time, @p4u1, could you clarify what's not working in
abra app cmd --local abra-test-recipe.local test_cmd_arg -- bing
?It seems like
bing
is meant to be passed totest_cmd_arg
, and--local
is meant to be handled byabra
, correct? What is happening instead?decentral1se referenced this issue2024-03-28 13:54:55 +00:00
@p4u1 and myself re-attempted to explain this to ourselves today... brain melter!
--
on the end as[-- ARGS]
is broken, (--
gets parsed as an argument)--local
on the end, doesn't actually work:--local
in thec.Args()
if you pass it in theabra app cmd --local <domain>
position (works!) but it is included if you pass it in theabra app cmd <domain> --local
and this breaks code inabra
that checks position ofc.Args()
for arguments. Sinceurfave/cli
is generatingabra app command command [command options] <domain> [<service>] <command> [-- <args>]
as the help, it means we're actually somehow abusing the fact that options can be passed after commands? We believe this is why they released the "breaking change" in v2, which was just fixing this bug. Hence, forcing people to adhere to advertised usage?abra app cmd
because the interface is quite weirdhttps://docs.coopcloud.tech/abra/trouble/#command-line-flag-handling-is-weird
https://git.coopcloud.tech/coop-cloud/docs.coopcloud.tech/pulls/256/files#diff-cc94fdc55a0f6e6e79d71b15081836752766bb20
😱
https://github.com/urfave/cli/pull/1928#issuecomment-2214466436
Update: someone tried to add the feature to
urfave/cli
but after a constant barrage of all the edge cases and ways in which it can go wrong, they gave up 😭 I'm now genuinely thinking of a spike to switch tocobra
because after some testing with thehugo
CLI UI/UX (which uses it), shit "just works".Hoping to kill this once and for all: coop-cloud/abra#435 (comment) (tldr; migrate to
cobra
)coop-cloud/abra#435
drunk style hackin' options everywhere is finally supported:
We have new problems now. I notice now that the
--help
handling is broken, e.g.abra app cmd foo.com --help
givesNo help topic for 'foo.com'
which is just broken. I'm going back to ripping out this CLI library, it is the source of all my morale destroying frustration.decentral1se referenced this issue from toolshed/abra2024-12-22 14:02:23 +00:00