Skip to content

Commit

Permalink
Add usage examples and use "up to next option" for cli multi args
Browse files Browse the repository at this point in the history
  • Loading branch information
nicorichard committed Jun 4, 2024
1 parent f2302a8 commit 9f1c21c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,28 @@
Setup deterministic validation of your app's `.xcstrings` [string catalogs](https://developer.apple.com/documentation/xcode/localizing-and-varying-text-with-a-string-catalog).

Ensure your string catalog changes are always up-to-snuff with your team's localization requirements.

## Usage

### CLI

Using a [config file](.xcstringslint.yaml)

```bash
swift run xcstringslint --config .xcstringslint.yaml \
Sources/StringCatalogValidator/Resources/Localizable.xcstrings
```

Using command line arguments

```bash
swift run xcstringslint \
--require-extraction-state automatic \
--require-locale en fr \
--require-localization-state translated \
Sources/StringCatalogValidator/Resources/Localizable.xcstrings
```

### GitHub Actions

See [this repository's actions for an example](.github/workflows/lint.yaml)
4 changes: 2 additions & 2 deletions Sources/XCStringsLint/XCStringsLint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ struct XCStringsLint: ParsableCommand {
@Option(name: .customLong(Rules.RequireLocale.name), parsing: .upToNextOption)
private var requireLocales: [String] = []

@Option(name: .customLong(Rules.RequireLocalizationState.name))
@Option(name: .customLong(Rules.RequireLocalizationState.name), parsing: .upToNextOption)
private var requireLocalizationStates: [String] = []

@Option(name: .customLong(Rules.RejectLocalizationState.name))
@Option(name: .customLong(Rules.RejectLocalizationState.name), parsing: .upToNextOption)
private var rejectLocalizationStates: [String] = []

mutating func run() throws {
Expand Down

0 comments on commit 9f1c21c

Please sign in to comment.