The StyleCI CLI Tool requires PHP 7.2.5 or higher, and can be installed either by directly downloading the phar, or using Composer.
Global installation:
$ curl -SsLo styleci.phar https://github.com/StyleCI/CLI/releases/download/v1.0.0/styleci.phar \
&& chmod +x styleci.phar && sudo mv styleci.phar /usr/local/bin/styleci
Local installation:
$ composer require styleci/cli:^1.0 --dev
Global installation:
$ composer global require styleci/cli:^1.0
When using the tool for the first time, you may want to enter your StyleCI API keys. You can do this with the styleci config
command, which will store your keys in ~/.styleci/config.json
, just like how Composer store keys.
styleci config auth.github YOUR-API-KEY-GOES-HERE
Your API key is available at https://github.styleci.io/profile.
styleci config auth.gitlab YOUR-API-KEY-GOES-HERE
Your API key is available at https://gitlab.styleci.io/profile.
styleci config auth.bitbucket YOUR-API-KEY-GOES-HERE
Your API key is available at https://bitbucket.styleci.io/profile.
Now, you can analyze any local copy of a repo enabled in StyleCI, from the console! Simply run:
$ styleci
and StyleCI will analyze your current directory.
If you have chosen not use the first time setup config, or would like to temporarily override the stored keys, this can be done by setting environment variables.
$ STYLECI_GITHUB_API_KEY=YOUR-API-KEY-GOES-HERE styleci
$ STYLECI_GITLAB_API_KEY=YOUR-API-KEY-GOES-HERE styleci
$ STYLECI_BITBUCKET_API_KEY=YOUR-API-KEY-GOES-HERE styleci
You can optionally pass a directory to analyze, otherwise, the current working directory will be used. Moreover, we support analyzing only the changed files, performing a "dry run" without touching your files, and more:
Usage:
analyze [options] [--] [<directory>]
Arguments:
directory
Options:
-c, --only-changed
-d, --dry-run
-g, --git-binary=GIT-BINARY
-r, --remote-name=REMOTE-NAME
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages
Note that styleci
is shorthand for styleci analyze
. This will matter if you want to analyze a directory with relevative path config
, or any other command name. You will need to write styleci analyze config
in order to use such a <directory>
argument.
This tool is licensed under The Apache License 2.0.