-
Notifications
You must be signed in to change notification settings - Fork 75
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
allow sorting to be configured globally (closes #418) #421
Open
cedi
wants to merge
3
commits into
hetznercloud:main
Choose a base branch
from
cedi:cedi/global-sort
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cedi
added a commit
to cedi/cli
that referenced
this pull request
Nov 16, 2022
I am a heavy user of the hcloud-cli. However, I usually change the columns that are displayed and don't like the default and would prefer specifying the default columns used in the config file. Note: This PR adds on top of the work of hetznercloud#421 and should not be merged before hetznercloud#421. Currently, I always type `hcloud server list -o 'columns=name,status,ipv6,private_net'` to only get the columns that I'm interested in since the `-o` flag is part of the `list` subcommand and not the `hcloud` base command (like in many other software that makes use of the Cobra framework), I cannot simply `alias hcloud-"hcloud -o 'columns='"` in my shell to default the columns. This commit adds a `[defaults]` section to the config toml which allows to override the default sorting behavior for individual `hcloud` subcommands. The following behavior is used to determine the displayed columns | config file | flag | result | |-------------|---------|-----------------------------| | not-set | not-set | display default columns | | not-set | set | display -o flag columns | | set | not-set | display config file columns | | set | set | display -o flag columns |
I am a heavy user of the hcloud-cli. However, I really don't like the default sorting by server-id, and would prefer sorting by age (see hetznercloud#417/hetznercloud#420) or name. Currently, I always type `hcloud server list -s name` to sort by name. since the `-s` flag is part of the `list` subcommand and not the `hcloud` base command (like in many other software that makes use of the Cobra framework), I cannot simply `alias hcloud-"hcloud -s name"` in my shell to default the sorting to "by name". This commit adds a `[defaults]` section to the config toml which allows to override the default sorting behavior for individual `hcloud` subcommands. The following behavior is used to determine the sorting-order | config file | flag | result | |-------------|---------|----------------------| | not-set | not-set | sort by id (default) | | not-set | set | sort by flag value | | set | not-set | sort by config value | | set | set | sort by flag value |
cedi
force-pushed
the
cedi/global-sort
branch
from
November 17, 2022 15:00
e3ffaf9
to
b07b039
Compare
cedi
added a commit
to cedi/cli
that referenced
this pull request
Nov 17, 2022
I am a heavy user of the hcloud-cli. However, I usually change the columns that are displayed and don't like the default and would prefer specifying the default columns used in the config file. Note: This PR adds on top of the work of hetznercloud#421 and should not be merged before hetznercloud#421. Currently, I always type `hcloud server list -o 'columns=name,status,ipv6,private_net'` to only get the columns that I'm interested in since the `-o` flag is part of the `list` subcommand and not the `hcloud` base command (like in many other software that makes use of the Cobra framework), I cannot simply `alias hcloud-"hcloud -o 'columns='"` in my shell to default the columns. This commit adds a `[defaults]` section to the config toml which allows to override the default sorting behavior for individual `hcloud` subcommands. The following behavior is used to determine the displayed columns | config file | flag | result | |-------------|---------|-----------------------------| | not-set | not-set | display default columns | | not-set | set | display -o flag columns | | set | not-set | display config file columns | | set | set | display -o flag columns |
This PR has been marked as stale because it has not had recent activity. The bot will close the PR if no further action occurs. |
This PR has been marked as stale because it has not had recent activity. The bot will close the PR if no further action occurs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am a heavy user of the hcloud-cli. However, I really don't like the default sorting by server-id, and would prefer sorting by age (see #417/#420) or name.
Currently, I always type
hcloud server list -s name
to sort by name.since the
-s
flag is part of thelist
subcommand and not thehcloud
base command (like in many other software that makes use of the Cobra framework), I cannot simplyalias hcloud-"hcloud -s name"
in my shell to default the sorting to "by name".This commit adds a
[defaults]
section to the config toml which allows to override the default sorting behavior for individualhcloud
subcommands.The following behavior is used to determine the sorting-order