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

Feature request: allow sorting to be configured globally #418

Open
cedi opened this issue Nov 13, 2022 · 4 comments
Open

Feature request: allow sorting to be configured globally #418

cedi opened this issue Nov 13, 2022 · 4 comments
Labels

Comments

@cedi
Copy link
Contributor

cedi commented Nov 13, 2022

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 where I request adding a computed "age" column) 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, I cannot simply alias hcloud-"hcloud -s name" in my shell to default the sorting to "by name".
I think this could be implemented as part of the configuration toml.
I would expect the following behavior:

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

I would also volunteer to implement this myself and submit a PR, but I wanted to gauge interest first, before putting in some work and having the PR rejected.

cedi added a commit to cedi/cli that referenced this issue Nov 16, 2022
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 added a commit to cedi/cli that referenced this issue Nov 17, 2022
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   |
@github-actions
Copy link
Contributor

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label Feb 12, 2023
@cedi
Copy link
Contributor Author

cedi commented Feb 15, 2023

@apricote bump

@apricote apricote removed the stale label Mar 17, 2023
@apricote apricote reopened this Mar 17, 2023
@github-actions
Copy link
Contributor

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label Jun 16, 2023
@apricote apricote removed the stale label Jun 16, 2023
@github-actions
Copy link
Contributor

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label Sep 15, 2023
@jooola jooola added pinned and removed stale labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants