-
Notifications
You must be signed in to change notification settings - Fork 64
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
hs open command #344
hs open command #344
Conversation
Nice! My only thought is that when I ran |
['$0 open settings/navigation'], | ||
['$0 open sn'], | ||
['$0 open 10'], | ||
]); |
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, this is cool. We should use it more.
packages/cms-lib/links.js
Outdated
@@ -0,0 +1,138 @@ | |||
const { getEnv } = require('./lib/config'); |
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 think we should keep this in cms-cli
since it is unlikely to be useful outside the CLI. Moving to CLI has the added benefit that it reduces the dependencies needed in @hubspot/cms-lib
.
packages/cms-lib/links.js
Outdated
const { logger } = require('./logger'); | ||
const chalk = require('chalk'); | ||
const { table, getBorderCharacters } = require('table'); | ||
var opn = require('opn'); |
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.
This looks to be deprecated in favor of open, which we're using elsewhere.
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 cool, thanks. I'll change it.
Maybe I am alone in this thought, but I think having too many ways to accomplish a task is confusing. Is there a reason that we need the numeric form? |
The use case was someone that does a |
Ah cool, good idea I can look into that |
Thanks for the feedback @gcorne and @anthmatic - incorporated both of your feedback. Took @gcorne advice and removed the ability to choose by index, and removed it from |
Added new
hs open
command. This command will open a shortcut in the user's web browser. The list so far isn't the definitive list, and can be added to as we see fit.There are a few different ways to use
hs open
.hs open
/hs open --list
- display a list of all available shortcutshs open shortcut-name
- open the shortcut with nameshortcut-name
in your browserhs open sn
- open the shortcut with an alias ofsn
in your browserhs open settings/navigation
- Some links are sublinks within larger sections. Stylistically, I used/
to show this.settings/navigation
means that we are opening the navigation section within settings.hs open 10
- open the shortcut at index 10 in your browser. I added this because I see a use case of someone doinghs open
to find the shortcut they want, then just wanting the fastest way to open it. They can glance at the index and do this as shorthand. The index is subject to change if we add more commands, so there is a tiny bit of danger if someone were to do something likehs open 10
in a script, but I think that risk is pretty negligible and I would hope someone would use the full command in their script anyways.