|
| 1 | +<a id="top"></a> |
| 2 | + |
| 3 | +# > remove-json-keys |
| 4 | + |
| 5 | +<a href="#"> |
| 6 | + <img height=31 src="https://img.shields.io/badge/Latest_Build-0.0.18-32fcee.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a> |
| 7 | +<a href="LICENSE.md"> |
| 8 | + <img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a> |
| 9 | +<a href="https://www.codefactor.io/repository/github/adamlui/python-utils"> |
| 10 | + <img height=31 src="https://img.shields.io/codefactor/grade/github/adamlui/python-utils?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=a0fc55&style=for-the-badge"></a> |
| 11 | +<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_python-utils"> |
| 12 | + <img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_python-utils%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=fafc74"></a> |
| 13 | + |
| 14 | +> ### _Simply remove JSON keys via CLI command._ |
| 15 | +
|
| 16 | +## Installation |
| 17 | + |
| 18 | +```bash |
| 19 | +pip install remove-json-keys |
| 20 | +``` |
| 21 | + |
| 22 | +## Usage |
| 23 | + |
| 24 | +Run the CLI: |
| 25 | +```bash |
| 26 | +remove-json-keys |
| 27 | +``` |
| 28 | + |
| 29 | +If no options are provided, the CLI will: |
| 30 | +1. Prompt for keys to delete |
| 31 | +2. Auto-discover closest child `json_dir` |
| 32 | +3. Delete keys from JSON files found in `json_dir` |
| 33 | + |
| 34 | +_Note: Key/values can span multiple lines and have any amount of whitespace between symbols._ |
| 35 | + |
| 36 | +## Options |
| 37 | + |
| 38 | +Options can be set by using command-line arguments: |
| 39 | + |
| 40 | +| Option | Description | Example |
| 41 | +| ---------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------ |
| 42 | +| `-d`, `--json-dir` | Name of the folder containing JSON files (default: `_locales`) | `--locales-dir=data` |
| 43 | +| `-k`, `--keys` | Comma-separated list of keys to remove | `--keys=appDesc,err_notFound` |
| 44 | +| `-W`, `--no-wizard` | Skip interactive prompts during start-up | |
| 45 | +| `-h`, `--help` | Show help screen | |
| 46 | + |
| 47 | +[supported-locales]: https://github.com/adamlui/python-utils/blob/translate-messages-1.1.0/translate-messages/src/translate_messages/package_data.json#L11-L16 |
| 48 | + |
| 49 | +## Examples |
| 50 | + |
| 51 | +Remove `author` key from JSON files found in default `_locales` dir: |
| 52 | + |
| 53 | +```bash |
| 54 | +remove-json-keys --keys=author -W |
| 55 | +``` |
| 56 | + |
| 57 | +Remove `appDesc` + `err_notFound` keys from JSON files found in default `data` dir: |
| 58 | + |
| 59 | +```bash |
| 60 | +remove-json-keys -d data -k appDesc,err_notFound -W |
| 61 | +``` |
| 62 | + |
| 63 | +## MIT License |
| 64 | + |
| 65 | +**Copyright © 2023–2026 [Adam Lui](https://github.com/adamlui).** |
| 66 | + |
| 67 | +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
| 68 | + |
| 69 | +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
| 70 | + |
| 71 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 72 | + |
| 73 | +# |
| 74 | + |
| 75 | +<a href="#top">Back to top ↑</a> |
0 commit comments