-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Get executable name from the command #326
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are missing a few such as ff start
message after an ff init
Signed-off-by: dwertent <david.wertenteil@kaleido.io>
@@ -53,7 +56,7 @@ func GetFireflyASCIIArt() string { | |||
|
|||
// rootCmd represents the base command when called without any subcommands | |||
var rootCmd = &cobra.Command{ | |||
Use: "ff", | |||
Use: ExecutableName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really need to make this usage message better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not part of this PR
@@ -39,6 +39,9 @@ var logger log.Logger = &log.StdoutLogger{ | |||
LogLevel: log.Debug, | |||
} | |||
|
|||
// name of the executable, this is for the help messages | |||
var ExecutableName string = os.Args[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so if this arg has paths it will show up...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, but it's intentional based on how it's being used. For example:
% ./path/to/exec/ff
To get started, run: ./path/to/exec/ff init
Optional: Set the FIREFLY_HOME environment variable for FireFly stack configuration path.
Usage:
./path/to/exec/ff [command]
Available Commands:
accounts Work with accounts in a FireFly stack
completion Generate the autocompletion script for the specified shell
deploy Deploy a compiled smart contract
docs Generate markdown documentation for all commands
help Help about any command
info Get info about a stack
init Create a new FireFly local dev stack
list List stacks
logs View log output from a stack
ps Returns information on running stacks
pull Pull a stack
remove Completely remove a stack
reset Clear all data in a stack
start Start a stack
stop Stop a stack
upgrade Upgrade a stack to a different version
version Prints the version info
Flags:
--ansi string Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
-h, --help Help for ./ff/ff
-v, --verbose Verbose log output
Use "./path/to/exec/ff [command] --help" for more information about a command.
As you can see, the executable was built locally in a subpath, so it makes sense for the help messages to reflect the subpath. This way, users can simply copy and paste the command from the help message without needing to adjust the path manually.
I think the build failed due to a failure in the coverage report generation, maybe we should re-run the build job (it passed last time and the only change I made was the var name) |
I reran it and it's still failing |
I'm quite puzzled about why we are getting a broken pipe, might some related to etcd-io/etcd#17560 or the permission in the workflow |
This PR enhances the FireFly CLI by making the executable name dynamic in the help messages. Instead of hardcoding the executable name, it is now loaded from the command-line arguments, allowing for dynamic help messages that reflect the actual executable name being used.
Before:
After: