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

fix: the output of command completion is displayed incorrectly #169

Merged
merged 6 commits into from
Nov 28, 2022

Conversation

hung-cybo
Copy link
Contributor

@hung-cybo hung-cybo commented Nov 24, 2022

Why

Currently, the output of command completion is displayed incorrectly.

  1. The alias does not align
  2. The content is broken if there is a new line character in the description.
$ cli-kintone record import
--api-token                -- App's API token                                                                                                                                                                                                               
--app                      -- The ID of the app                                                                                                                                                                                                             
--attachments-dir          -- Attachment file directory                                                                                                                                                                                                     
--base-url                 -- Kintone Base Url                                                                                                                                                                                                              
--basic-auth-password      -- Kintone Basic Auth Password                                                                                                                                                                                                   
--basic-auth-username      -- Kintone Basic Auth Username                                                                                                                                                                                                   
--encoding                 -- Character encoding                                                                                                                                                                                                            
--fields                   -- The fields to be imported in comma-separated                                                                                                                                                                                  
--file-path                -- The path to source file.                                                                                                                                                                                                      
--guest-space-id           -- The ID of guest space                                                                                                                                                                                                         
--help                     -- Show help                                                                                                                                                                                                                     
--password                 -- Kintone Password                                                                                                                                                                                                              
--pfx-file-password        -- The password of client certificate file                                                                                                                                                                                       
--pfx-file-path            -- The path to client certificate file                                                                                                                                                                                           
--proxy                    -- The URL of a proxy server                                                                                                                                                                                                     
--update-key               -- The key to Bulk Update                                                                                                                                                                                                        
--username                 -- Kintone Username                                                                                                                                                                                                              
--version                  -- Show version number                                                                                                                                                                                                           
-p                     -u  --                                                                                                                                                                                                                               
The file extension should be ".csv"

What

  • Do not display the alias (There is a bug of yargs)
  • Remove the line break in the description of the option

How to test

yarn build

# Config cli-kintone command completion. Ref: https://github.com/kintone/cli-kintone#command-completion

./cli.js record import --[Tab]

Checklist

  • Read CONTRIBUTING.md
  • Updated documentation if it is required.
  • Added tests if it is required.
  • Passed yarn lint and yarn test on the root directory.

@hung-cybo hung-cybo requested a review from a team as a code owner November 24, 2022 01:44
@hung-cybo hung-cybo requested review from tasshi-me and removed request for a team November 24, 2022 01:44
src/cli/record/export.ts Outdated Show resolved Hide resolved
src/cli/record/import.ts Outdated Show resolved Hide resolved
Copy link
Member

@tasshi-me tasshi-me left a comment

Choose a reason for hiding this comment

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

Works well!
But it's good to do a little refactoring.

$ node ./cli.js --get-yargs-completions record import -
--version:Show version number
--help:Show help
--base-url:Kintone Base Url
--username:Kintone Username
--password:Kintone Password
--api-token:App's API token
--basic-auth-username:Kintone Basic Auth Username
--basic-auth-password:Kintone Basic Auth Password
--app:The ID of the app
--guest-space-id:The ID of guest space
--attachments-dir:Attachment file directory
--file-path:The path to source file. The file extension should be ".csv"
--encoding:Character encoding
--update-key:The key to Bulk Update
--fields:The fields to be imported in comma-separated
--pfx-file-path:The path to client certificate file
--pfx-file-password:The password of client certificate file
--proxy:The URL of a proxy server

src/cli/main.ts Outdated Show resolved Hide resolved
src/cli/main.ts Outdated Show resolved Hide resolved
Copy link
Member

@tasshi-me tasshi-me left a comment

Choose a reason for hiding this comment

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

LGTM!!

@tasshi-me tasshi-me merged commit b44a99e into main Nov 28, 2022
@tasshi-me tasshi-me deleted the fix/622-command-completion-display-incorrect branch November 28, 2022 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants