Skip to content

Commit

Permalink
refactor(cli): Resolve hidden aliases (#2878)
Browse files Browse the repository at this point in the history
* Adding --no-aliases to 'oclif readme' runs

* Refactor hidden aliases

* Remove aliases from commands-output.ts

* Updating @oclif/core to v2.16.0 and required dependencies
  • Loading branch information
sbosio committed May 14, 2024
1 parent 2074b60 commit 67fb46e
Show file tree
Hide file tree
Showing 25 changed files with 57 additions and 108 deletions.
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"bugs": "https://github.com/heroku/cli/issues",
"dependencies": {
"@heroku-cli/color": "2.0.1",
"@heroku-cli/command": "^10.0.0",
"@heroku-cli/command": "^11.0.0",
"@heroku-cli/notifications": "^1.2.4",
"@heroku-cli/plugin-certs-v5": "^9.0.0-alpha.0",
"@heroku-cli/plugin-ps": "^8.1.7",
Expand All @@ -16,7 +16,7 @@
"@heroku/buildpack-registry": "^1.0.1",
"@heroku/eventsource": "^1.0.7",
"@heroku/heroku-cli-util": "^8.0.13",
"@oclif/core": "^2.8.11",
"@oclif/core": "^2.16.0",
"@oclif/plugin-commands": "2.2.2",
"@oclif/plugin-help": "^5",
"@oclif/plugin-legacy": "^1.3.0",
Expand Down Expand Up @@ -369,7 +369,7 @@
"test:unit:justTest:ci": "nyc mocha --forbid-only \"test/**/*.unit.test.ts\"",
"test": "yarn pretest && yarn test:unit:justTest:ci",
"test:local": "yarn pretest && yarn test:unit:justTest:local",
"version": "oclif readme --multi && git add README.md ../../docs"
"version": "oclif readme --multi --no-aliases && git add README.md ../../docs"
},
"types": "lib/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/cli/src/commands/addons/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class Create extends Command {
static topic = 'addons'
static description = 'create a new add-on resource'
static strict = false
static aliases = ['addons:add']
static hiddenAliases = ['addons:add']
static flags = {
name: flags.string({description: 'name for the add-on resource'}),
as: flags.string({description: 'name for the initial add-on attachment'}),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/addons/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Destroy extends Command {
static description = 'permanently destroy an add-on resource'
static strict = false
static examples = ['addons:destroy [ADDON]... [flags]']
static aliases = ['addons:remove']
static hiddenAliases = ['addons:remove']
static flags = {
force: flags.boolean({char: 'f', description: 'allow destruction even if connected to other apps'}),
confirm: flags.string({char: 'c'}),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async function runFromManifest(context: ParserOutput<Create>, heroku: APIClient)
export default class Create extends Command {
static description = 'creates a new app'

static aliases = ['create']
static hiddenAliases = ['create']

static examples = [
`$ heroku apps:create
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as git from '../../lib/ci/git'
export default class Destroy extends Command {
static description = 'permanently destroy an app'
static help = 'This will also destroy all add-ons on the app.'
static aliases = ['destroy', 'apps:delete']
static hiddenAliases = ['destroy', 'apps:delete']
static flags = {
app: flags.app(),
remote: flags.remote(),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function print(apps: Heroku.App, user: Heroku.Account, space?: string, team?: st
export default class AppsIndex extends Command {
static description = 'list your apps'
static topic = 'apps'
static aliases = ['list', 'apps:list']
static hiddenAliases = ['list', 'apps:list']

static examples = [
'$ heroku apps',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function print(info: Heroku.App, addons: Heroku.AddOn[], collaborators: Heroku.C
export default class AppsInfo extends Command {
static description = 'show detailed app information'
static topic = 'apps'
static aliases = ['info']
static hiddenAliases = ['info']

static examples = [
'$ heroku apps:info',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as open from 'open'
export default class AppsOpen extends Command {
static description = 'open the app in a web browser'
static topic = 'apps'
static aliases = ['open']
static hiddenAliases = ['open']

static examples = [
'$ heroku open -a myapp',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class AppsRename extends Command {
static description = 'rename an app'
static help = 'This will locally update the git remote if it is set to the old app.'
static topic = 'apps'
static aliases = ['rename']
static hiddenAliases = ['rename']

static examples = [
'$ heroku apps:rename --app oldname newname',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/stacks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function updateCedarName(stack: string) {
export default class StacksIndex extends Command {
static description = 'show the list of available stacks'
static topic = 'apps'
static aliases = ['stack']
static hiddenAliases = ['stack']

static flags = {
app: flags.app({required: true}),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/apps/stacks/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Setting stack to heroku-22... done
You will need to redeploy myapp for the change to take effect.
Run git push heroku main to trigger a new build on myapp.`

static aliases = ['stack:set']
static hiddenAliases = ['stack:set']

static flags = {
app: flags.app({required: true}),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/config/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const lastRelease = async (client: APIClient, app: string) => {
export default class Set extends Command {
static description = 'set one or more config vars'
static strict = false
static aliases = ['config:add']
static hiddenAliases = ['config:add']
static examples = [
`$ heroku config:set RAILS_ENV=staging
Setting config vars and restarting example... done, v10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type {Setting, SettingKey} from '../../../lib/pg/types'
export default class LogMinDurationStatement extends PGSettingsCommand {
static description = heredoc(`
The duration of each completed statement will be logged if the statement completes after the time specified by VALUE.
VALUE needs to specified as a whole number, in milliseconds.
Setting log_min_duration_statement to zero prints all statement durations and -1 will disable logging statement durations.
VALUE needs to specified as a whole number, in milliseconds.
Setting log_min_duration_statement to zero prints all statement durations and -1 will disable logging statement durations.
`)

static args = {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/ps/restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {Args, ux} from '@oclif/core'
export default class Restart extends Command {
static description = 'restart app dynos'
static topic = 'ps'
static aliases = ['restart', 'dyno:restart']
static aliases = ['dyno:restart']
static hiddenAliases = ['restart']

static examples = [
'$ heroku ps:restart web.1',
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/ps/scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default class Scale extends Command {
web=3:Standard-2X worker=1:Standard-1X
`]

static aliases = ['dyno:scale', 'scale']
static aliases = ['dyno:scale']
static hiddenAliases = ['scale']
static flags = {
app: flags.app({required: true}),
remote: flags.remote(),
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/ps/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {Args, ux} from '@oclif/core'
export default class Stop extends Command {
static description = 'stop app dyno'
static topic = 'ps'
static aliases = ['dyno:stop', 'ps:kill', 'dyno:kill', 'stop', 'kill']
static aliases = ['dyno:stop', 'ps:kill', 'dyno:kill']
static hiddenAliases = ['stop', 'kill']

static examples = [
'$ heroku ps:stop run.1828',
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/ps/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ export default class Type extends Command {
Called with 1..n TYPE=SIZE arguments sets the quantity per type.
`
static aliases = ['ps:resize', 'resize', 'dyno:type', 'dyno:resize']
static aliases = ['ps:resize', 'dyno:resize']
static hiddenAliases = ['resize', 'dyno:type']
static flags = {
app: flags.app({required: true}),
remote: flags.remote(),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/releases/rollback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {stream} from '../../lib/releases/output'

export default class Rollback extends Command {
static topic = 'releases'
static aliases = ['rollback']
static hiddenAliases = ['rollback']
static description = 'rollback to a previous release'
static help = 'If RELEASE is not specified, it will rollback one release'
static flags = {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/spaces/peerings/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {displayPeeringInfo} from '../../../lib/spaces/peering'

export default class Info extends Command {
static topic = 'spaces'
static hiddenAliases = ['spaces:peering:info']
static description = heredoc(`
display the information necessary to initiate a peering connection
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/spaces/trusted-ips/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import heredoc from 'tsheredoc'

export default class Add extends Command {
static topic = 'spaces'
static aliases = ['trusted-ips:add']
static hiddenAliases = ['trusted-ips:add']
static description = heredoc(`
Add one range to the list of trusted IP ranges
Uses CIDR notation.`)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/spaces/trusted-ips/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import heredoc from 'tsheredoc'

export default class Index extends Command {
static topic = 'spaces'
static aliases = ['trusted-ips']
static hiddenAliases = ['trusted-ips']
static description = heredoc(`
list trusted IP ranges for a space
Trusted IP ranges are only available on Private Spaces.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/spaces/trusted-ips/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import heredoc from 'tsheredoc'

export default class Remove extends Command {
static topic = 'spaces'
static aliases = ['trusted-ips:remove']
static hiddenAliases = ['trusted-ips:remove']
static description = heredoc(`
Remove a range from the list of trusted IP ranges
Uses CIDR notation.`)
Expand Down
27 changes: 4 additions & 23 deletions packages/cli/test/acceptance/commands-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ access:add add new users to your app
access:remove remove users from a team app
access:update update existing collaborators on an team app
addons lists your add-ons and attachments
addons:add create a new add-on resource
addons:attach attach an existing add-on resource to an app
addons:create create a new add-on resource
addons:destroy permanently destroy an add-on resource
Expand All @@ -17,14 +16,12 @@ addons:downgrade change add-on plan
addons:info show detailed add-on resource and attachment information
addons:open open an add-on's dashboard in your browser
addons:plans list all available plans for an add-on service
addons:remove permanently destroy an add-on resource
addons:rename rename an add-on
addons:services list all available add-on services
addons:upgrade change add-on plan
addons:wait show provisioning status of the add-ons on the app
apps list your apps
apps:create creates a new app
apps:delete permanently destroy an app
apps:destroy permanently destroy an app
apps:errors view app errors
apps:favorites list favorited apps
Expand All @@ -33,7 +30,6 @@ apps:favorites:remove unfavorites an app
apps:info show detailed app information
apps:join add yourself to a team app
apps:leave remove yourself from a team app
apps:list list your apps
apps:lock prevent team members from joining an app
apps:open open the app in a web browser
apps:rename rename an app
Expand Down Expand Up @@ -95,7 +91,6 @@ clients:rotate rotate OAuth client secret
clients:update update OAuth client
commands list all the commands
config display the config vars for an app
config:add set one or more config vars
config:edit interactively edit config vars
config:get display a single config value for an app
config:remove unset one or more config vars
Expand All @@ -109,8 +104,6 @@ container:push builds, then pushes Docker images
container:release Releases previously pushed Docker images to your Heroku app
container:rm remove the process type from your app
container:run builds, then runs the docker image locally
create creates a new app
destroy permanently destroy an app
domains list domains for an app
domains:add add a domain to an app
domains:clear remove all domains from an app
Expand All @@ -126,27 +119,23 @@ dyno:resize manage dyno sizes
dyno:restart restart app dynos
dyno:scale scale dyno quantity up or down
dyno:stop stop app dyno
dyno:type manage dyno sizes
features list available app features
features:disable disables an app feature
features:enable enables an app feature
features:info display information about a feature
git:clone clones a heroku app to your local machine at DIRECTORY (defaults to app name)
git:remote adds a git remote to an app repo
help Display help for heroku.
info show detailed app information
join add yourself to a team app
keys display your SSH keys
keys:add add an SSH key for a user
keys:clear remove all SSH keys for current user
keys:remove remove an SSH key from the user
kill stop app dyno
labs list experimental features
labs:disable disables an experimental feature
labs:enable enables an experimental feature
labs:info show feature info
leave remove yourself from a team app
list list your apps
local run heroku app locally
local:run run a one-off command
local:start run heroku app locally
Expand All @@ -163,7 +152,6 @@ members:add adds a user to a team
members:remove removes a user from a team
members:set sets a members role in a team
notifications display notifications
open open the app in a web browser
orgs list the teams that you are a member of
orgs:open open the team interface in a browser window
pg show database information
Expand Down Expand Up @@ -214,6 +202,7 @@ pg:settings:auto-explain:log-min-duration Sets the minimum execution time i
pg:settings:auto-explain:log-nested-statements Nested statements are included in the execution plan's log.
pg:settings:auto-explain:log-triggers Includes trigger execution statistics in execution plan logs.
pg:settings:auto-explain:log-verbose Include verbose details in execution plans.
pg:settings:log-connections Controls whether a log message is produced when a login attempt is made. Default is true.
pg:settings:log-lock-waits Controls whether a log message is produced when a session waits longer than the deadlock_timeout to acquire a lock. deadlock_timeout is set to 1 second
pg:settings:log-min-duration-statement The duration of each completed statement will be logged if the statement completes after the time specified by VALUE.
pg:settings:log-statement log_statement controls which SQL statements are logged.
Expand Down Expand Up @@ -277,15 +266,10 @@ releases display the releases for an app
releases:info view detailed information for a release
releases:output View the release command output
releases:rollback rollback to a previous release
rename rename an app
resize manage dyno sizes
restart restart app dynos
reviewapps:disable disable review apps and/or settings on an existing pipeline
reviewapps:enable enable review apps and/or settings on an existing pipeline
rollback rollback to a previous release
run run a one-off process inside a heroku dyno
run:detached run a detached dyno, where output is sent to your logs
scale scale dyno quantity up or down
sessions list your OAuth sessions
sessions:destroy delete (logout) OAuth session by ID
spaces list available spaces
Expand All @@ -300,6 +284,9 @@ spaces:ps list dynos for a space
spaces:rename renames a space
spaces:topology show space topology
spaces:transfer transfer a space to another team
spaces:trusted-ips list trusted IP ranges for a space
spaces:trusted-ips:add Add one range to the list of trusted IP ranges
spaces:trusted-ips:remove Remove a range from the list of trusted IP ranges
spaces:vpn:config display the configuration information for VPN
spaces:vpn:connect create VPN
spaces:vpn:connections list the VPN Connections for a space
Expand All @@ -308,14 +295,8 @@ spaces:vpn:info display the information for VPN
spaces:vpn:update update VPN
spaces:vpn:wait wait for VPN Connection to be created
spaces:wait wait for a space to be created
stack show the list of available stacks
stack:set set the stack of an app
status display current status of the Heroku platform
stop stop app dyno
teams list the teams that you are a member of
trusted-ips list trusted IP ranges for a space
trusted-ips:add Add one range to the list of trusted IP ranges
trusted-ips:remove Remove a range from the list of trusted IP ranges
twofactor check 2fa status
twofactor:disable disables 2fa on account
unlock unlock an app so any team member can join
Expand Down
2 changes: 1 addition & 1 deletion scripts/postrelease/dev_center_docs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ These are the help texts for each of the core Heroku CLI commands. You can also
<!-- commands -->
EOF
oclif readme
oclif readme --no-aliases
grep -v "^\\* \\[\`" README.md | grep -v "^<!--" | sed "s/^## \`/### \`/g" | sed "/_See\ code\:/d" > /tmp/heroku-cli-commands.md
git checkout README.md
devcenter push /tmp/heroku-cli-commands.md --trace

0 comments on commit 67fb46e

Please sign in to comment.