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

Closed
cedi opened this issue Nov 13, 2022 · 5 comments
Closed

Feature request: allow sorting to be configured globally #418

cedi opened this issue Nov 13, 2022 · 5 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
phm07 added a commit that referenced this issue Jul 10, 2024
…rce (#795)

This PR adds options to configure the default sorting column for each
resource that supports the `list` command.
See #418 and #434
@phm07
Copy link
Contributor

phm07 commented Jul 11, 2024

Feature was implemented in #795 - see my comment here: #421 (comment)
Since the feature is now implemented I will close this issue as completed. Thanks for your suggestion!

@phm07 phm07 closed this as completed Jul 11, 2024
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

4 participants