Non ambigous Argmuent and Flag position #581
Closed
opened 2024-03-07 17:37:42 +00:00 by p4u1
·
13 comments
Labels
Clear labels
abra
awaiting-feedback
backups
bug
build
ci/cd
community organising
contributing
coopcloud.tech
design
documentation
duplicate
enhancement
fedi
fedi-infra
finance
funding
good first issue
help wanted
installer
legal
performance
proposal
question
security
test
wontfix
Everything to do with abra
Ping/pong on comms
Something is not working
Go build related issues
Getting the robots into the mix
Opening this thing up
Contributors stuff
Our main website
Design thinking required
Let's write things together
This issue or pull request already exists
New feature
Democratic decision making
Money things
Anything related to grant funding
Easy start with development
Need some help
Installation related issues
Performance related
Large change which requires feedback & decisin making
More information is needed
Securing our shit
Unit or integration test suite
This won't be fixed
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
3wordchant
aadil (Aadil Ayub)
abra-bot (Abra Bot)
ammaratef45
amras (Sarma)
Apfelwurm
BornDeleuze
Brooke
carla
cas (Cassowary)
coopcloud
cyrnel
decentral1se (d1)
dede
devydave
fauno (fauno)
iexos
jade (Jade Ambrose)
jjsfunhouse
jmakdah2 (Jackie Makdah)
joe-irving (Joe Irving)
kawaiipunk (KawaiiPunk)
knoflook
kolaente
lambdabundesverband
linnealovespie (April)
moosemower
moritz
notplants
oxaliq (sorrel)
p4u1
pharaohgraphy (Andrew 🐦🔥❤️🔥✴️)
renovate-bot (Comrade Renovate Bot)
ripclap
simon
sixsmith (Sixsmith)
stevensting
trav (Trav Fryer)
val (val (he/him))
yksflip
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: toolshed/organising#581
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Let's take
abra app cmdas 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
0e688f1407by downgrading our cli libraryurfave/clifrom v2 to v1.This had the consequence, that the following does not work anymore:
I prose to upgrade
urfave/cliback 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#v2is best. Release ofv2.27.1was 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
abraand 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
bingis meant to be passed totest_cmd_arg, and--localis 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)--localon the end, doesn't actually work:--localin 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> --localand this breaks code inabrathat checks position ofc.Args()for arguments. Sinceurfave/cliis 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 cmdbecause 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/clibut 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 tocobrabecause after some testing with thehugoCLI 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
--helphandling is broken, e.g.abra app cmd foo.com --helpgivesNo 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