# @xml-locales/cli

> [![NPM](https://img.shields.io/npm/v/xml-locales.svg)](https://www.npmjs.com/package/xml-locales)

Latest version **1.1.0** (published 2025-09-25) · 0 weekly downloads

## Install

```sh
npm install @xml-locales/cli
pnpm add @xml-locales/cli
yarn add @xml-locales/cli
bun add @xml-locales/cli
```

Provides the command `xml-locales`.

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities; has provenance.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2025-09-25 |
| First published | 2023-11-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 3 |
| Unpacked size | 17 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Maintainers | pisyukaev |
| Keywords | xml-locales, xml, locales, tool, cli-tool |

## Links

- npm: https://www.npmjs.com/package/@xml-locales/cli
- Repository: https://github.com/Pisyukaev/xml-locales
- Homepage: https://github.com/Pisyukaev/xml-locales#readme
- Issues: https://github.com/Pisyukaev/xml-locales/issues
- npm.io page: https://npm.io/package/@xml-locales/cli

## Dependencies (3)

- [diff](https://npm.io/package/diff.md) 5.1.0
- [yargs](https://npm.io/package/yargs.md) 17.7.2
- [xml-locales](https://npm.io/package/xml-locales.md) 1.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2025-09-25
- 1.0.0 — 2024-02-13
- 0.0.8 — 2023-12-05
- 0.0.7 — 2023-11-27
- 0.0.6 — 2023-11-23
- 0.0.5 — 2023-11-23
- 0.0.4 — 2023-11-21
- 0.0.3 — 2023-11-21
- 0.0.2 — 2023-11-21
- 0.0.1 — 2023-11-21

## README

# @xml-locales/cli

[![NPM](https://img.shields.io/npm/v/xml-locales.svg)](https://www.npmjs.com/package/xml-locales)

This is cli tool to work with localization files in xml.

## Installation

```sh
npm install -g @xml-locales/cli
```

```sh
yarn global add @xml-locales/cli
```

```sh
pnpm add -g @xml-locales/cli
```

> [!IMPORTANT]
> This package, which works with XML files, has one root node named `resources`. This root node has child nodes named `string`. For example:
>
> ```xml
> <resources>
>   <string name="key1">value1</string>
>   <string name="key2">value2</string>
> </resources> 
>```

### Or use without

```sh
npx @xml-locales/cli <command> [...args]
```

## Commands

### Add Command

The `add` command is used to add a new key(s)-value(s) pair to the XML localization file or files from directory.

```sh
xml-locales add --path path/to/file_or_directory --keys newKey --values newValue
```

| Flag    | Alias | Default | Description                                                                 |
|---------|-------|---------|-----------------------------------------------------------------------------|
| `--path`| `-p`  | `process.cwd()`    | The path to the XML localization file or directory where the key-value pair will be added. |
| `--keys` | `-k`  | None    | The new key(s) to be added.                                                    |
| `--values`| `-v` | None   | The value(s) to be associated with the new key.                                |

### Remove Command

The `remove` command is used to remove a key(s)-value(s) pair from the XML localization file or files from directory.

```sh
xml-locales remove --path path/to/file_or_directory --keys keyToRemove --values valueToRemove
```

| Flag    | Alias | Default | Description                                                                 |
|---------|-------|---------|-----------------------------------------------------------------------------|
| `--path`| `-p`  | `process.cwd()`    | The path to the XML localization file or directory where the key-value pair will be removed. |
| `--keys` | `-k`  | None    | Removed string by the key(s).                                                      |
| `--values`| `-v` | None   | Or removed string by the value(s). |

### Update Command

The `update` command is used to update a key(s)-value(s) pair in the XML localization file or files from directory.

```sh
xml-locales update --path path/to/file_or_directory --old oldValue --new newValue
```

| Flag       | Alias | Default | Description                                                                 |
|------------|-------|---------|-----------------------------------------------------------------------------|
| `--path`   | `-p`  | `process.cwd()`    | The path to the XML localization file or directory where the key-value pair will be updated. |
| `--old` | `-o`  | None    | The old key(s) or value(s) to be updated.                                        |
| `--new`| `-n` | None   | The new key(s) or value(s) to replace the old one.                               |

### Sort Command

The `sort` command is used to sort the keys in the XML localization file or directory in ascending or descending order.

```sh
xml-locales sort --path path/to/file_or_directory --direction asc_or_desc
```

| Flag       | Alias | Default | Description                                                                 |
|------------|-------|---------|-----------------------------------------------------------------------------|
| `--path`   | `-p`  | `process.cwd()`    | The path to the XML localization file or directory where the keys will be sorted. |
| `--direction` | `-d`  | 'asc'    | The sort direction. Can be 'asc' for ascending order or 'desc' for descending order. |

### Convert Command

The `convert` command is used to convert the XML localization file or directory to JSON format.

```sh
xml-locales convert --path path/to/file_or_directory
```

| Flag       | Alias | Default | Description                                                                 |
|------------|-------|---------|-----------------------------------------------------------------------------|
| `--path`   | `-p`  | `process.cwd()`    | The path to the XML localization file or directory where the file will be converted. |

## Packages

| Package  | version   |
| ------- | -------- |
| 📦[xml-locales](https://github.com/Pisyukaev/xml-locales/tree/master/packages/xml-locales) | [![NPM](https://img.shields.io/npm/v/xml-locales.svg)](https://www.npmjs.com/package/xml-locales)   |
| 💻[@xml-locales/cli](https://github.com/Pisyukaev/xml-locales/tree/master/packages/cli)   | [![NPM](https://img.shields.io/npm/v/@xml-locales/cli.svg)](https://www.npmjs.com/package/@xml-locales/cli)  |

---
_Source: https://npm.io/package/@xml-locales/cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
