Skip to content

Commit fb0b74d

Browse files
authored
docs: argument file and croql string (#917)
1 parent fb9b47b commit fb0b74d

3 files changed

Lines changed: 62 additions & 1 deletion

File tree

src/main/java/com/crowdin/cli/commands/picocli/PicocliRunner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ private void init() {
5858
.setExecutionExceptionHandler(executionExceptionHandler)
5959
.setColorScheme(colorScheme)
6060
.setCaseInsensitiveEnumValuesAllowed(true)
61-
.setExitCodeExceptionMapper(ExitCodeExceptionMapper::getExitCode);
61+
.setExitCodeExceptionMapper(ExitCodeExceptionMapper::getExitCode)
62+
.setExpandAtFiles(true);
6263
HelpCommand.setOptions(commandLine, System.out, colorScheme);
6364
}
6465

website/docs/advanced.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,39 @@ Example of the configuration:
168168
]
169169
```
170170

171+
### Argument File
172+
173+
Crowdin CLI supports loading command-line arguments from a file.
174+
The arguments can be stored in a plain text file and be passed to the CLI using the `@filename` syntax.
175+
176+
This can be useful when:
177+
- You have a long list of options
178+
- You want to reuse the same configuration
179+
- You want to avoid issues with escaping special characters (like quotes) on Windows shells (PowerShell, cmd.exe)
180+
181+
#### How to use
182+
Create a text file containing the arguments you would normally type in the command line.
183+
Each argument must be separated by a new line.
184+
In your CLI command, reference the file using `@` followed by the filename.
185+
186+
Example file (args.txt):
187+
```
188+
--branch feat
189+
--directory src
190+
```
191+
192+
Run CLI using file:
193+
194+
```bash
195+
crowdin string list @args.txt
196+
```
197+
198+
For PowerShell:
199+
200+
```powershell
201+
crowdin string list "@args.txt"
202+
```
203+
171204
### Multilingual Files
172205

173206
For multilingual file formats (containing multiple languages in one file) you can use the `multilingual` option in the configuration. This option allows you to omit the language placeholders in the `translation` pattern:

website/mantemplates/crowdin-string-list.adoc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,33 @@ include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options]
1515

1616
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer]
1717

18+
=== Notes
19+
20+
When passing CroQL queries or any argument that includes double quotes ("), correct escaping is required depending on the shell you are using.
21+
22+
If you do not use an link:https://crowdin.github.io/crowdin-cli/advanced#argument-file[argument file], here is how to manually format your command:
23+
24+
- Bash (Linux, macOS, Git Bash)
25+
Use single quotes ' around the entire query:
26+
27+
```bash
28+
crowdin string list --croql 'identifier CONTAINS "label"'
29+
```
30+
31+
- PowerShell
32+
Escape each double quote " by using escaped backticks `:
33+
34+
```powershell
35+
crowdin string list --croql "identifier CONTAINS \`"label\`""
36+
```
37+
38+
- cmd.exe (Command Prompt)
39+
Escape double quotes by doubling them "":
40+
41+
```cmd
42+
crowdin string list --croql "identifier CONTAINS ""label"""
43+
```
44+
1845
=== See also
1946

2047
* link:https://developer.crowdin.com/croql/[Crowdin Query Language (CroQL)]

0 commit comments

Comments
 (0)