Skip to content

Commit

Permalink
feat: add advanced-cli-use.md article
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff committed Mar 22, 2019
1 parent 985cdeb commit b5d4bc9
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions advanced-cli-use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Snyk CLI Advanced Use

## Alternate ways of running the Snyk CLI
For npm projects, an alternate way of using the Snyk CLI is to add the `snyk` module to your package.json by running
```npm install snyk```
Then you can run the CLI using either (running a `snyk test` in these examples):
```
node node_modules/snyk/dist/cli/index.js test
```
or
```
./node_modules/.bin/snyk test
```

One advantage of doing this is that you'd always have the latest version of the Snyk CLI by running `npm install`.

## snyk test for all build files
Running `snyk test` in an application directory will test only the first build/manifest file found. For example, if you hava a Java + Maven project with a pom.xml file in the root and several modules, each with their own pom.xml, you would typically have to run `snyk test` for each one.

Say for example you have a Java + Maven project with three pom.xml files - one root and two modules:
```
./pom.xml
./module1/pom.xml
./module2/pom.xml
```

Then you can test all of them by running these three separate commands:
```
snyk test
snyk test module1
snyk test module2
```

You can also group them into a single command like this:
```
snyk test . module1 module2
```

In other words, you can specify each directory you want to test.

Another option would be to do something like this - which finds all the pom.xml files for you:
```
snyk test $(find . -name "pom.xml" -exec dirname {} \;)
```

0 comments on commit b5d4bc9

Please sign in to comment.