Skip to content

Commit

Permalink
feat: overhauling the help screen generator so it's consistent everyw…
Browse files Browse the repository at this point in the history
…here (#397)

* feat: swapping our colors for chalk

* chore: reverting some unnnecessary changes

* feat: overhauling the help screen generator so it's consistent everywhere

* feat: simplify command listings

* ci: fixing chalk to always run in ci

* fix: reverting a command description change

* test: updating snapshots

* fix: "check out" instead of "checkout"
  • Loading branch information
erunion authored Dec 2, 2021
1 parent 2a6a240 commit 69fadd3
Show file tree
Hide file tree
Showing 14 changed files with 346 additions and 153 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,3 @@ updates:
- dependency-name: node-fetch
versions:
- ">= 3"
# table-layout is now an ESM package and can't be used here without a rewrite.
- dependency-name: table-layout
versions:
- ">= 3"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
- name: Run tests
run: npm test
env:
# `chalk` has troubles with color detection while on CI and also in how it's used within our tests.
# `chalk` has troubles with color detection while on CI.
# https://github.com/chalk/supports-color/issues/106
FORCE_COLOR: 1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `rdme` - ReadMe's CLI
# 📖 rdme

[![](https://d3vv6lp55qjaqc.cloudfront.net/items/1M3C3j0I0s0j3T362344/Untitled-2.png)](https://readme.com)

Expand Down
234 changes: 234 additions & 0 deletions __tests__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`cli --help should not surface args that are designated as hidden 1`] = `
"
Alias for \`rdme openapi\`. [deprecated]
Usage
rdme swagger [file] [options]
Options
--key string Project API key
--id string Unique identifier for your API definition. Use this if you're resyncing an
existing API definition
--version string Project version
-h, --help Display this usage guide
Related commands
$ rdme openapi Upload, or resync, your OpenAPI/Swagger definition to ReadMe.
"
`;

exports[`cli --help should print help 1`] = `
"
📖 rdme
a utlity for interacting with ReadMe
.
.\\\\ /.
’ ‘ ‘ ‘
( nn\\\\ . . / )
(nnnnn,.MM. AM .nn.
.nnnndMM----_______--M.’’ /
|nnn/nnnnnnnnnnnnnnnnn\\\\’mmm/
/nnnn...nnnnnnnnnnn...mmmmm\\\\
/nn ‘qnnnP’ ‘mmm\\\\
/n’ .XXX. \\\\nnn/ .XX. \\\\mmb
An (XOXX) nnn (XOXX) mm\\\\
/nn ‘XXXX’.~”~. ‘XXX”’ .mmmb
dnnn. ( )n. .mmmmb
.nnnnnn....n.\\\\ ./nnnnnnnnnmmmmmm\\\\
(READnnnnnnnnnnn’Y’nnnnnnnnnnmmmmmmME)
REinnnnnnnnnnnnnnnnnnnnnnnnnmmmmmmmAD/
/MEEnnnnnnnnnnnnnnnnnnnnnnnnnmmmmmmm)E'.
READnnnnnnn*’ ‘*mmmmmmmm)MEE.
(READ|nnnn’ \\\\../ \\\\.../ ‘mmmmmM)EEE)
READ(nn*’ ‘mmm.MEEE)
‘READn’ \\\\._./ \\\\__./ \\\\.../ ‘MEE*’
* /*
Usage
rdme <command> [arguments]
Options
-h, --help Display this usage guide
-v, --version Show the current rdme version
Administration
$ rdme login Login to a ReadMe project.
$ rdme logout Logs the currently authenticated user out of ReadMe.
$ rdme whoami Displays the current user and project authenticated with ReadMe.
Upload OpenAPI/Swagger definitions
$ rdme openapi Upload, or resync, your OpenAPI/Swagger definition to ReadMe.
$ rdme swagger Alias for \`rdme openapi\`. [deprecated]
Documentation
$ rdme docs Sync a folder of markdown files to your ReadMe project.
$ rdme docs:edit Edit a single file from your ReadMe project without saving locally.
Versions
$ rdme versions List versions available in your project or get a version by SemVer
(https://semver.org/).
$ rdme versions:create Create a new version for your project.
$ rdme versions:update Update an existing version for your project.
$ rdme versions:delete Delete a version associated with your ReadMe project.
Other useful commands
$ rdme oas Helpful OpenAPI generation tooling.
$ rdme open Open your current ReadMe project in the browser.
Run rdme help <command> for help with a specific command.
To get more help with ReadMe, check out our docs at https://docs.readme.com.
"
`;
exports[`cli --help should print help for the \`-H\` alias 1`] = `
"
📖 rdme
a utlity for interacting with ReadMe
.
.\\\\ /.
’ ‘ ‘ ‘
( nn\\\\ . . / )
(nnnnn,.MM. AM .nn.
.nnnndMM----_______--M.’’ /
|nnn/nnnnnnnnnnnnnnnnn\\\\’mmm/
/nnnn...nnnnnnnnnnn...mmmmm\\\\
/nn ‘qnnnP’ ‘mmm\\\\
/n’ .XXX. \\\\nnn/ .XX. \\\\mmb
An (XOXX) nnn (XOXX) mm\\\\
/nn ‘XXXX’.~”~. ‘XXX”’ .mmmb
dnnn. ( )n. .mmmmb
.nnnnnn....n.\\\\ ./nnnnnnnnnmmmmmm\\\\
(READnnnnnnnnnnn’Y’nnnnnnnnnnmmmmmmME)
REinnnnnnnnnnnnnnnnnnnnnnnnnmmmmmmmAD/
/MEEnnnnnnnnnnnnnnnnnnnnnnnnnmmmmmmm)E'.
READnnnnnnn*’ ‘*mmmmmmmm)MEE.
(READ|nnnn’ \\\\../ \\\\.../ ‘mmmmmM)EEE)
READ(nn*’ ‘mmm.MEEE)
‘READn’ \\\\._./ \\\\__./ \\\\.../ ‘MEE*’
* /*
Usage
rdme <command> [arguments]
Options
-h, --help Display this usage guide
-v, --version Show the current rdme version
Administration
$ rdme login Login to a ReadMe project.
$ rdme logout Logs the currently authenticated user out of ReadMe.
$ rdme whoami Displays the current user and project authenticated with ReadMe.
Upload OpenAPI/Swagger definitions
$ rdme openapi Upload, or resync, your OpenAPI/Swagger definition to ReadMe.
$ rdme swagger Alias for \`rdme openapi\`. [deprecated]
Documentation
$ rdme docs Sync a folder of markdown files to your ReadMe project.
$ rdme docs:edit Edit a single file from your ReadMe project without saving locally.
Versions
$ rdme versions List versions available in your project or get a version by SemVer
(https://semver.org/).
$ rdme versions:create Create a new version for your project.
$ rdme versions:update Update an existing version for your project.
$ rdme versions:delete Delete a version associated with your ReadMe project.
Other useful commands
$ rdme oas Helpful OpenAPI generation tooling.
$ rdme open Open your current ReadMe project in the browser.
Run rdme help <command> for help with a specific command.
To get more help with ReadMe, check out our docs at https://docs.readme.com.
"
`;
exports[`cli --help should print usage for a given command 1`] = `
"
Alias for \`rdme openapi\`. [deprecated]
Usage
rdme swagger [file] [options]
Options
--key string Project API key
--id string Unique identifier for your API definition. Use this if you're resyncing an
existing API definition
--version string Project version
-h, --help Display this usage guide
Related commands
$ rdme openapi Upload, or resync, your OpenAPI/Swagger definition to ReadMe.
"
`;
exports[`cli --help should print usage for a given command if supplied as \`help <command>\` 1`] = `
"
Alias for \`rdme openapi\`. [deprecated]
Usage
rdme swagger [file] [options]
Options
--key string Project API key
--id string Unique identifier for your API definition. Use this if you're resyncing an
existing API definition
--version string Project version
-h, --help Display this usage guide
Related commands
$ rdme openapi Upload, or resync, your OpenAPI/Swagger definition to ReadMe.
"
`;
exports[`cli --help should show related commands for a subcommands help menu 1`] = `
"
List versions available in your project or get a version by SemVer (https://semver.org/).
Usage
rdme versions [options]
Options
--key string Project API key
--version string A specific project version to view
--raw Return raw output from the API instead of in a \\"pretty\\" format.
-h, --help Display this usage guide
Related commands
$ rdme versions:create Create a new version for your project.
$ rdme versions:update Update an existing version for your project.
$ rdme versions:delete Delete a version associated with your ReadMe project.
"
`;
2 changes: 1 addition & 1 deletion __tests__/cmds/logout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('rdme logout', () => {

return cmd.run({}).then(msg => {
expect(msg).toBe(
`You have logged out of Readme. Please use \`${config.cli} ${loginCmd.command}\` to login again.`
`You have logged out of ReadMe. Please use \`${config.cli} ${loginCmd.command}\` to login again.`
);
});
});
Expand Down
Loading

0 comments on commit 69fadd3

Please sign in to comment.