difference in sequence of command line options results in different behaviour #10
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
The command
gfu -d -i gophermap
will:gophermap
gophermap
The same command written as
gfu gophermap -d -i
tries to read from stdin.Golang's flag package does not allow positional arguments to come before flags. By that I mean, it allows it, but it breaks. :(
Well, thanks for the tip. It would have taken me a while to figure that out!
It is not great that the flag package implements this in an unusual way. I can document it to make it clearer.
The cobra library keeps coming up when looking in to things like this. Looks interesting.
Documentation updated. An alternative is to avoid arguments, and use a flag to specify an input file. For example:
gfu -d --input-file=gophermap --output-file=plaintext
Let me know if this is preferred.
I like the idea of positional arguments to handle it, but I agree that it is less flexible than the ideal. What do you think? I could go either way. Using flags gives the added benefit of clarity I suppose.
I'm also split on this, but maybe moreso about fixing it within the boundaries of the standard libraries, or fixing it nicely by using Cobra.
Adding an external, non-standard dependency for something as simple as this doesn't seem very correct, but (for me at least) this has been a great place to experiment and learn by trying new things.
Something to consider as time permits.
I agree re: added dependencies. It seems like it should be workable without an outside dependency. For my Python programs I generally just write an argument parser myself and take everything in from the command line as a list. This could be done here as well. That would eliminate the outside library, provide a learning opportunity in Go, and solve the problem (in theory). Maybe a route to go eventually. For now the documentation update seems solid.