-
Notifications
You must be signed in to change notification settings - Fork 56
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
Added hs config commands #464
Conversation
@abelb @jasminetudor do you have any suggestions on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a UX perspective, I wonder if we should assume that the only actions that can be taken are to interact with the accounts in the config. I say this because there are other global config options that could have corresponding config commands for updating them, which makes me wonder if we should have commands like hs config rename-account
and hs config default-account
or similar.
I also didn't comment on all the places where portal
is used instead of account
in user-facing copy.
packages/cli/commands/config/list.js
Outdated
|
||
const config = getConfig(); | ||
const portalData = config.portals.reduce((acc, portal) => { | ||
acc.push([portal.name, portal.portalId, portal.authType]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if authType
should be an enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could definitely make it an enum
though it's not elsewhere in the code. I think doing this may be out of scope for this PR though.
Is there something that you're worried about with not using an enum
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry I was thinking that we could validate that a correct authType exists but might not be a big deal
packages/cli/commands/config.js
Outdated
.command({ | ||
...list, | ||
aliases: 'ls', | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding the alias here, can we add to the command in config/list
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we list aliases of subcommands in the parent command we don't have to sift through each subcommand to find every alias and avoid collisions. It also matches the current pattern for the hs list
(hs ls
) and hs functions list
(hs functions ls
).
packages/cli/commands/config/list.js
Outdated
portalData.unshift(getTableHeader(['Name', 'Portal ID', 'Auth Type'])); | ||
|
||
logger.log(getTableContents(portalData)); | ||
logger.log('Default Portal: ', config.defaultPortal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is the best place for this, but it would be helpful to print out the path of the config file, which might be helpful for folks to know which config the CLI is actually loading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gcorne can you give me an example of the global config commands that would conflict with these? |
Since Global configuration options:
Account configuration:
|
@miketalley we are thinking... but we would change:
to stick with the format of:
|
To clarify -- For example: Having 0 positional arguments for a command is a bit strange to me. I don't think that there are currently any other commands in the CLI that do not function unless an What are other people's thoughts? |
After discussion with @erincouse and @jasminetudor on the It can be used to select from a list by running |
Maybe it is just me, but I struggle with the expectations when it comes to |
We can definitely expand the output to include I think changing the |
I think I am stuck on |
I'd be fine with having this functionality nested as |
I'd imagine that it would be used for the "global" config options that are not related to a specific account like |
…ortal is a portalId
… about circular dependency
…ed' as the new table version will do
…em from hs config command
66028cc
to
f8bd2ed
Compare
Small comment: I think |
One idea is to maybe do this? It makes the commands longer but it nests them underneath config and renaming them AND the list are all data that lives in config. Thoughts @jasminetudor @erincouse @miketalley?
|
Otherwise @miketalley everything looks good to me! |
@erincouse can you elaborate on why? Is your expectation that |
In addition to |
I think there are two ways to organize the commands that are being thought about...
I can see good reasons for each. Having the That said, I think @gcorne's idea (and as @erincouse, @abelb, @jasminetudor, and I have discussed separately) of deprecating |
Description and Context
#27 Finally getting around to this
Adds six new commands
hs config set default-account [accountNameOrId]
- selects portal to use asdefaultPortal
from a list or by specifyingaccountNameOrId
hs config set default-mode [mode]
- selects mode to use asdefaultMode
in config, also supports specifyingmode
as argumenths config set http-timeout <timeout>
- setshttpTimeout
in confighs config set allow-usage-tracking
- selects value forallowUsageTracking
in confighs accounts list
(aliashs accounts ls
) - lists portalname
s,portalId
s, andauthType
s in table format as well asdefaultPortal
hs accounts rename <currentNameOrId> <newName>
- allows naming/renaming a portalname
in the config (will also updatedefaultPortal
if that is the one that is renamed)Screenshots
hs config set default-account
hs config set default-mode
hs config set http-timeout
hs config set allow-usage-tracking
hs accounts list
hs accounts rename
Notes:
defaultPortal
was a numbergetAccountId
was returningnull