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

Upload command from docs not working #176

Closed
robertorubioguardia opened this issue Jan 7, 2021 · 4 comments
Closed

Upload command from docs not working #176

robertorubioguardia opened this issue Jan 7, 2021 · 4 comments

Comments

@robertorubioguardia
Copy link

Hi guys,

I had to reorder the arguments in the upload command for it to work. Using it as stated in your docs it failed.

The working form was:

npx @getmeli/cli upload \
    ./public \
    --url https://myurl.tld \
    --site mysiteid \
    --token sometoken \
    --branch "master"

Note the folder was moved and put before the rest of the arguments. Error was: Not enough non-option arguments: got 0, need at least 1

Cheers and thanks for such a great tool.

@gempain
Copy link
Contributor

gempain commented Jan 7, 2021

@robertorubioguardia hi ! Thanks for reporting this. It's a known issue, when the --branch argument is last, yargs breaks for a reason I haven't been able to figure yet. Another way to workaround this is by placing --branch as non last argument:

npx @getmeli/cli upload \
    --url https://myurl.tld \
    --site mysiteid \
    --branch "master" \
    --token sometoken \
    ./public

I will update the docs with your suggestion to avoid confusion in the future 😄

gempain pushed a commit to getmeli/meli-docs that referenced this issue Jan 7, 2021
@gempain
Copy link
Contributor

gempain commented Jan 7, 2021

I just updated the docs. I'll close, but we'll reopen if further help is needed 😄

@gempain gempain closed this as completed Jan 7, 2021
@phillipplum
Copy link

It's a known issue, when the --branch argument is last, yargs breaks for a reason I haven't been able to figure yet.

@gempain hello, is it a problem that branch can be an array (https://github.com/getmeli/meli-cli/blob/1ea83325797010c257c238536cccb4c653b04824/src/commands/upload/upload-options.ts#L49)? See the following link: yargs/yargs#164

So I think that's why the error comes, that one argument is missing.
Because yargs then interprets:
--branch = "master" ./public as ['master', '. /public']

@gempain
Copy link
Contributor

gempain commented Jan 7, 2021

@phillipplum hi there ! Thanks for jumping 😄 The problem definitely comes from branch being an array, but not from what you describe. AFAIK, arrays are specified by providing the same option multiple times: --branch branch1 --branch branch2. So, I would assume Yargs to understand that --branch branch ./public is ['branch'] 🤔

We could open an issue there to see what's going on.

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

No branches or pull requests

3 participants