Skip to content
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

Change most global flags into local ones #1652

Conversation

anthonyfok
Copy link
Member

This is to ensure that only the relevant command-line flags
for a certain Hugo subcommand is shown to the end user,
reducing clutter and improving user experience.

Fixes #1624 - CLI UX: Flags shouldn't be global

@anthonyfok anthonyfok force-pushed the 1624-change-most-global-flags-to-local-ones branch 4 times, most recently from 6800b37 to 597b051 Compare December 2, 2015 19:04
@anthonyfok
Copy link
Member Author

For some of the commands where the cmdName is passed along in InitializeConfig(cmdName),
I had to move the RunE function definition out of the Command struct definition and set it in init() instead, like how it was done in server.go, to avoid an initialization loop during compile:

/home/foka/go/src/github.com/spf13/hugo/commands/list_config.go:58: initialization loop:
    /home/foka/go/src/github.com/spf13/hugo/commands/list_config.go:58 configCmd refers to
    /home/foka/go/src/github.com/spf13/hugo/commands/list_config.go:58 configCmd

This is to ensure that only the relevant command-line flags
for a certain Hugo subcommand is shown to the end user,
reducing clutter and improving user experience.

Fixes gohugoio#1624 - CLI UX: Flags shouldn't be global
@anthonyfok anthonyfok force-pushed the 1624-change-most-global-flags-to-local-ones branch from 597b051 to 00d0477 Compare December 3, 2015 07:38
@anthonyfok anthonyfok merged commit 00d0477 into gohugoio:master Dec 3, 2015
anthonyfok added a commit that referenced this pull request Dec 3, 2015
The crash was introduced by commit 00d0477 in PR #1652
where access to NoTimes was attempted even though --noTimes
was not defined for the config, check and benchmark commands.

Special thanks to @bep for the heads-up!

See also #1624 - CLI UX: Flags shouldn't be global
anthonyfok added a commit that referenced this pull request Dec 16, 2015
v0.15 had it, but I removed it inadvertently for 0.16-DEV
in commit 00d0477 in PR #1652.

Also add directory bash-completion for `--source`
for `hugo convert`, `hugo list` and `hugo new`.

See #1624, #1589
bramp pushed a commit to bramp/hugo that referenced this pull request Dec 17, 2015
The crash was introduced by commit 00d0477 in PR gohugoio#1652
where access to NoTimes was attempted even though --noTimes
was not defined for the config, check and benchmark commands.

Special thanks to @bep for the heads-up!

See also gohugoio#1624 - CLI UX: Flags shouldn't be global
tychoish pushed a commit to tychoish/hugo that referenced this pull request Aug 13, 2017
The crash was introduced by commit 00d0477 in PR gohugoio#1652
where access to NoTimes was attempted even though --noTimes
was not defined for the config, check and benchmark commands.

Special thanks to @bep for the heads-up!

See also gohugoio#1624 - CLI UX: Flags shouldn't be global
tychoish pushed a commit to tychoish/hugo that referenced this pull request Aug 13, 2017
v0.15 had it, but I removed it inadvertently for 0.16-DEV
in commit 00d0477 in PR gohugoio#1652.

Also add directory bash-completion for `--source`
for `hugo convert`, `hugo list` and `hugo new`.

See gohugoio#1624, gohugoio#1589
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI UX: Flags shouldn't be global
2 participants