CLI: More options

Last modified: March 30, 2021Author: Jakub Pomykała

More configuration options for CLI. If you need more configuration options, then checkout what else you can set up.

Use configuration file

Create simplelocalize.yaml file

projectType: yahoo/react-intl
searchDir: ./src

Now you can just run CLI command without passing parameters. Try simplelocalize extract. to see how it works.

Custom configuration file path

To use custom configuration file you can use -c <PATH> or --config <PATH> parameter.


simpleloclize-cli  --config ./path/to/config.yaml [COMMAND]

Please notice that configuration parameter comes before COMMAND!

Ignore translation keys

apiKey: <API_KEY>
projectType: <PROJECT_TYPE>
    - "HEY"
    - "PLEASE"
    - ":("

Note: Ignore keys feature is only available though configuration file.

Custom search directory

If you would like to search translation keys in some specific path you can achieve this by adding searchDir property, and the path where CLI should search for the keys.

apiKey: <API_KEY>
projectType: <YOUR_PROJECT_TYPE>
searchDir: /Users/jpomykala/Workspace/MyProject

Please pay attention to what you are putting in the 'searchDir' property. Script will go through all files from given path to find the keys - giving a root path may cause high CPU and disc usage.

Configuration profiles

If you would like to use simplelocalize.yml from custom location or with custom name like simplelocalize-dev.yml file, you can achieve that easily by passing path as the first argument.

$ simplelocalize --config /tmp/simplelocalize-dev.yml [command] --apiKey YOUR_API_KEY