percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
70 stars 43 forks source link

--ignore-files does not work #220

Closed j-quelly closed 3 years ago

j-quelly commented 3 years ago
percy - v
@percy/cli/1.0.0-beta.39 darwin-x64 node-v12.16.2

The documentation does not match output of --help from the CLI. Everything that's documented returns an error Error: Unexpected arguments:

Only after 45 minutes of trial and error did I learn that the correct arguments are:

Results in snapshotting what I want for one use case

percy snapshot out --files blog --dry-run

It seems globs are not working. 🤦 ie:

percy snapshot out --files blog/* --dry-run
zsh: no matches found: blog/*

Ignore is also not working with and without glob

node_modules/.bin/percy snapshot out --ignore blog docs legacy-docs --dry-run
[percy] Error: No snapshots found

It appears removing dry run may fix this????

node_modules/.bin/percy snapshot out --ignore blog docs legacy-docs --enable_javascript
[percy] Percy has started
...
Robdel12 commented 3 years ago

Hey @j-quelly! You're using the old "CLI" (@percy/agent) docs with the new CLI package. The new proper CLI snapshot docs are located here: https://docs.percy.io/docs/cli-snapshot

I've added a warning to the top of the current snapshot docs (for @percy/agent). 👍🏼 We're aiming to have @percy/agent fully deprecated by the end of the quarter and all SDKs migrated over to the new toolchain (follow along on #57)


As for the globs, can you add --verbose to get debug logs?

wwilsman commented 3 years ago

Hey @j-quelly! I wanted to add that the globs and your arguments are likely not being interpreted correctly.

For instance, in your second example your shell is automatically expanding the glob (as mine does). That’s why the error is from zsh and not Percy. You’ll want to make sure you add quotes to the glob to prevent that from happening.

For your last example, you have the ignore flag followed by three directories, but how will the command know which arguments belong to the flag and which arguments might be positional arguments? It can’t, so it only treats the first arg as the value and ignores the rest.

To use multiple globs, you must specify the flag multiple times (--ignore blog --ignore docs --ignore legacy-docs). You could also construct a single glob to match all files (e.g. --ignore "{blog,docs,legacy-*}").

Hope this helps!

Robdel12 commented 3 years ago

Going to close out but feel free to keep commenting :)