-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Inconsistent Name for Application from inside Subcommands #974
Conversation
refer to program name over app name
I don't think we should add any public API, we should just fix App.Name to always be the same thing. |
Codecov Report
@@ Coverage Diff @@
## master #974 +/- ##
==========================================
+ Coverage 73.36% 73.54% +0.18%
==========================================
Files 32 32
Lines 2440 2446 +6
==========================================
+ Hits 1790 1799 +9
+ Misses 540 537 -3
Partials 110 110
Continue to review full report at Codecov.
|
@lynncyrin ☝️ @AudriusButkevicius You are right about currying through the context. We actually have a |
It's unclear if anyone relies on the current behavior of |
Also, this should be happening inside the issue => #783 rather than inside this pull request. Pull requests aren't a good context for collecting information and discussion like this. |
I consider this PR WIP and not approve-able until consensus on the desired solution is reached, that conversation should happen here => #783 |
For the sake of making this the most recent comment - this PR is blocked in discussion in => #783 |
This issue or PR has been automatically marked as stale because it has not had recent activity. Please add a comment bumping this if you're still interested in it's resolution! Thanks for your help, please let us know if you need anything else. |
Closing this as it has become stale. |
@meatballhat i see there’s a test failing. Will take a look at this later today. |
@asahasrabuddhe Can you check if we still need this in latest release ? I've made some changes that actually fixes this. |
Fixed in latest release. |
Motivation
Fixes #783
The current behavior of the
app.Name
is not consistent and results in a bad experience for the users. The PR attempts to fix this until such time a better solution is in place (v3)Release Notes
Adds
ProgramName
andCommandName
. TheProgramName
will always contain the name of the application as defined by the user. TheCommandName
will include theProgramName
with the name of the command, and it's parent commands.Changes
app.go
- Added theProgramName
andCommandName
members to theApp
struct. InitializeProgramName
for the first time.command.go
- Added logic to initialise and update theProgramName
andCommandName
members. Make use of the context lineage to set theProgramName
correctly.command-test.go
- Added a test case to validate above change'helpers_test.go
- Addedequal
method to compare slicesTesting
I used the following program to help test:
The same program was modified to write the test case.
Reviewer Guidelines
The PR is marked as a v2 feature. However, I thought that this, being a simple change, it would be worth our while to get this into v1 for the sake of sanity.