gum icon indicating copy to clipboard operation
gum copied to clipboard

Can't get full name while there have a space between first name and last name

Open mayflower-zc opened this issue 3 years ago • 2 comments

Can't get full name while there have a space between first name and last name. Example: Tom Hanks Got: Tom

mayflower-zc avatar Jul 02 '21 07:07 mayflower-zc

@mayflower-zc Which version of gum? v1.0.4 has been supported

gauseen avatar Jul 02 '21 10:07 gauseen

I have reproduced this issue.

environment

gum version: v1.0.4 operating system: macOS bigSur

procedure

gum set hello --name hello world --email [email protected] 
gum list  

result:

┌────────────┬─────────────────────┬────────────────────────┐
│ group-name │                name │                  email │
├────────────┼─────────────────────┼────────────────────────┤
│     global │ 周宇盛 Yusheng Zhou  │ [email protected] │
│      hello │               hello │   [email protected] │
└────────────┴─────────────────────┴────────────────────────┘

the global git config's name can have space, but the config in gum can't have space

solution

use quote

gum set hello --name 'hello world' --email [email protected] 
gum list  

┌────────────┬─────────────────────┬────────────────────────┐
│ group-name │                name │                  email │
├────────────┼─────────────────────┼────────────────────────┤
│     global │ 周宇盛 Yusheng Zhou  │ [email protected] │
│      hello │         hello world │  [email protected] │
└────────────┴─────────────────────┴────────────────────────┘

or gum preprocess the argument list before pass them to commander.js

reason

the argument list get from process.argv treat hello world as seperate argument, and commander.js can not recognize the argument world.

source code:

  • get command line argument in gum : https://github.com/gauseen/gum/blob/master/src/index.js#L40
  • parse command line argument in commander.js : https://github.com/tj/commander.js/blob/master/lib/command.js#L1286

jasonzhouu avatar Jul 15 '21 03:07 jasonzhouu