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

🌺 Quality of life improvements #49

Merged
merged 30 commits into from
Aug 2, 2019
Merged

Conversation

erunion
Copy link
Member

@erunion erunion commented Jul 20, 2019

rdme as it exists has a horde of usability issues:

  • No commands are documented.
  • There's no way to get help for individual commands (and they aren't documented anyway).
  • Error handling is all over the place. Sometimes we return nice, colored, errors, others we dump raw JSON responses to the console.

There's got to be a better way!

1CDX

Improvements

  • All commands have been fully documented.
  • More command categories/groups have been created: "Administration", "Sync Swagger/OpenAPI files", "Documentation", and "Versions"
  • Heavily improved error handling to account for the wide variety of error cases that might happen (API errors, type errors, bad command argument errors, unexpected errors, etc.)
  • Cleaned up a lot of the errors that we were returning so they're more consistently represented.
  • 🆕 Added support for getting help via rdme <command> --help and rdme help <command>
  • 🆕 Related commands are now surfaced on command help screens. So for example if you do rdme help versions, you'll see a related commands list of every other versions-related command available.
  • 🆕 Owlbert has been added to the main rdme help screen because everyone needs more Owlbert.

In action

$ ./rdme.js

          ░                                        ░
          ░░                                       ░░
        ░░░░░                                     ░░░░ ░
       ░░░░░░░                                    ░░░░░░
       ▐░░░░░░▄                                 ░░░░░░░░░
       ░░░░░░░░░▐░░░                        ░░░░░░░░░░░░░   rdme
        ░░░░░░░░░░░░░░░░░▐▐▐░░░░░░░░░░▐▐░░░░░░░░░░░░░░░░░░
      ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░    a utlity for interacting with ReadMe.io
      ▐░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
      ▐░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
      ▐░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▄▄░░░
      ▐░░░░░░░░░░░░░░░▄█▓▓▓▓▓▓█▄░░░░░░░░░░░░░░▄█▓▓▓▓▓▓▓▓▓▄░          ░░
      ▐░░░░░░░░░░░░▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄░░░░░░░░░▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄       ░░░░░░░░░
      ░░░░░░░░░░░░▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌░░░░░░░▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄      ░░░░░░░░░░
      ░░░░░░░░░░░▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄░░░░░░▒▓▓▓▓█▀▓▓▓▓▓▓▓▓▓▓▓    ░░░░░░░░░░░░░░░░
      ░░░░░░░░░░░▒▓▓▓▓▀  ▓▓▓▓▓▓▓▓▓▓▓▌░░░░░░▐▓▓▓   ▀▀▓▓▓▓▓▓▓▓▌   ░░░░░░░░░░░░░░░░
      ▐░░░░░░░░░░▐▓▓▓▌     ▐▓▓▓▓▓▓▓▓░░░░░░░░▀▓▓▄   ▄▓▓▓▓▓▓▓▓   ░░░░░░░░░░░░░░░░
      ▐░░░░░░░░░░░▐▓▓▓▌▄ ▄▄▓▓▓▓▓▓▓▓▀░░░░░░░░░░▀▓▓▓▓▓▓▓▓▓▓█▀  ░░░░░░░░░░░░░░░░
      ▐░░░░░░░░░░░░░▀▓▓▓▓▓▓▓▓▓▓▓█▀░░░░░░░░░░░░░░░▀▀▀▀▀▀░░░  ░░░░░░░░░░░░░░░
      ▐░░░░░░░░░░░░░░░░▀▀▀▀▀▀▀░░░░░░░░░░▄▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
      ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░
     ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▀▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▀░░░░░░░░░░░░░░░░░░░░░
   ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Usage: rdme <command> [arguments]

Available commands

  Administration
    $ rdme login             Login to a ReadMe project. 

  Sync Swagger/OpenAPI files
    $ rdme swagger           Upload, or sync, your Swagger/OpenAPI file to ReadMe. 

  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:delete   Delete a version associated with your ReadMe project.           
    $ rdme versions:update   Update an existing version for your project.                    

  Other useful commands
    $ rdme open              Open your current ReadMe project in the browser.                
    $ rdme oas               OAS related tasks. See https://npm.im/oas for more information. 

Options

  -h, --help       Display this usage guide      
  -v, --version    Show the current rdme version 

Run rdme help <command> for help with a specific command.

$ ./rdme.js help versions

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   Project version          
  -h, --help         Display this usage guide 

Related commands

  $ rdme versions:create   Create a new version for your project.                
  $ rdme versions:delete   Delete a version associated with your ReadMe project. 
  $ rdme versions:update   Update an existing version for your project.          

@erunion erunion added the enhancement New feature or request label Jul 20, 2019
@erunion erunion changed the title Quality of life improvements 🌺 Quality of life improvements Jul 22, 2019
@erunion erunion marked this pull request as ready for review July 23, 2019 00:53
@erunion
Copy link
Member Author

erunion commented Jul 23, 2019

@gratcliff You should take a look at this to make sure I didn't lose anything you added in the versions additions.

@gratcliff
Copy link
Member

@gratcliff You should take a look at this to make sure I didn't lose anything you added in the versions additions.

Absolutely! In the processes of looking as we speak. Some of that fs work is top notch!

@amyshi188
Copy link

amyshi188 commented Jul 24, 2019

I noticed when importing a spec file with the CLI tool that the command is different:
Screen Shot 2019-07-24 at 12 23 16 PM

It doesn't indicate that the Swagger file needs to come after "swagger" which might be confusing to new users. It would be clearer if it looked something like this: rdme swagger {path-to-swagger.json} --key={api-key}, which we show on https://www.npmjs.com/package/rdme.

I don't know what the reason was for changing it but maybe this is something to consider?

@erunion
Copy link
Member Author

erunion commented Jul 25, 2019

@amyshi188 How about this instead:

$ ./rdme.js help swagger

Upload, or sync, your Swagger/OpenAPI file to ReadMe.

Usage

  rdme swagger [path-to-spec.json] 

Options

  --key string       Project API key                                                               
  --id string        Unique identifier for your specification. Use this if you're resyncing an     
                     existing specification                                                        
  --version string   Project version                                                               
  -h, --help         Display this usage guide                                                      

I kind of want to keep --key off the usage line for it because it's technically not required because if you've used rdme login we save your key and re-use that.

@mjcuva
Copy link
Member

mjcuva commented Jul 25, 2019

@amyshi188 We actually changed it so you don't need the path to the file anymore! If you don't provide one it will automatically try to find one, and if it can't then we ask the user to enter the path. So for new users it's probably better to not include the path at all!

@erunion
Copy link
Member Author

erunion commented Jul 25, 2019

I'm good to keep the usage for the swagger command as rdme swagger [spec] since it'll be nice to know when looking for help on that command to see that it does take a spec as an argument even though it's optional.

I talked offline with @gratcliff and I've accidentally removed a heap of argument support on the new versions commands, so I'm working on resurrecting those.

@erunion
Copy link
Member Author

erunion commented Jul 26, 2019

@gratcliff @mjcuva Pushed up a handful of fixes for the versions commands that I broke, as well as updating rdme versions to return its data within a table:

$ ./rdme.js versions
┌─────────┬──────────┬───────────────┬───────────┬─────────┬───────────┬──────────────────────────┐
│ Version │ Codename │ Is deprecated │ Is hidden │ Is beta │ Is stable │ Created on               │
├─────────┼──────────┼───────────────┼───────────┼─────────┼───────────┼──────────────────────────┤
│ 1.0     │          │ yes           │ yes       │ yes     │ no        │ 2019-06-17T22:39:56.462Z │
└─────────┴──────────┴───────────────┴───────────┴─────────┴───────────┴──────────────────────────┘

@gratcliff
Copy link
Member

@gratcliff @mjcuva Pushed up a handful of fixes for the versions commands that I broke, as well as updating rdme versions to return its data within a table:

$ ./rdme.js versions
┌─────────┬──────────┬───────────────┬───────────┬─────────┬───────────┬──────────────────────────┐
│ Version │ Codename │ Is deprecated │ Is hidden │ Is beta │ Is stable │ Created on               │
├─────────┼──────────┼───────────────┼───────────┼─────────┼───────────┼──────────────────────────┤
│ 1.0     │          │ yes           │ yes       │ yes     │ no        │ 2019-06-17T22:39:56.462Z │
└─────────┴──────────┴───────────────┴───────────┴─────────┴───────────┴──────────────────────────┘

I agree with you that the table is cleaner, but it's pruning some key information in regards to pulling specific versions:
Screen Shot 2019-07-29 at 2 10 16 PM

Copy link
Member

@gratcliff gratcliff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall. Clean code is previously mentioned. In regards to version outputs, it may be beneficial to dump JSON. Either A) for mocking or B) to pipe into a bash script for programmatic usage. Otherwise, there should be differing information between rdme versions and rdme versions --version=VERSION (select v entire object dump, respectively). If you'd like to keep the table, maybe it makes sense to add a pretty flag?

@erunion
Copy link
Member Author

erunion commented Jul 29, 2019

@gratcliff That's fair, but I was thinking that since this is a CLI wrapper around the API, that everything should be "pretty" by default. Maybe we can add a raw option to the versions command that'll dump the raw API output instead?

I'll go back and work in the missing data for the single version that I'm not currently surfacing in the prettified version though.

@gratcliff
Copy link
Member

@gratcliff That's fair, but I was thinking that since this is a CLI wrapper around the API, that everything should be "pretty" by default. Maybe we can add a raw option to the versions command that'll dump the raw API output instead?

I'll go back and work in the missing data for the single version that I'm not currently surfacing in the prettified version though.

Works for me! If we do can you update the README.md to reflect that?

@erunion
Copy link
Member Author

erunion commented Jul 30, 2019

@gratcliff Took another pass on versions and it's ready for your review again.

Version: 1.0
Codename: None
Created on: 2019-06-17T22:39:56.462Z
Released on: 2019-06-17T22:39:56.462Z
┌───────────────┬───────────┬─────────┬───────────┐
│ Is deprecated │ Is hidden │ Is beta │ Is stable │
├───────────────┼───────────┼─────────┼───────────┤
│ yes           │ yes       │ yes     │ no        │
└───────────────┴───────────┴─────────┴───────────┘

Since we don't have an API endpoint to pull information from categories, I'm opting (for now) to not expose that in the "pretty" format, but I did add a --raw option to just dump the API output to the terminal instead.

@gratcliff gratcliff self-requested a review August 2, 2019 21:31
Copy link
Member

@gratcliff gratcliff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jon this looks fantastic! Minor request below

@gratcliff gratcliff self-requested a review August 2, 2019 22:59
@erunion erunion merged commit 5213eba into master Aug 2, 2019
@erunion erunion deleted the feature/qol-improvements branch August 2, 2019 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants