tooling: add update-command script (#11974)

* tooling: add update-command script

* update-command: add os import

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* update-command: remove sync argument and small refactor

* update-command: add shebang and license

* update-command: remove unused function

* update-command: add dry-run option

* update-command: add docs in header

* update-command: fix old_common_part var name

* update-command: require command without .md

* update-command: fix command name in description

Co-authored-by: Juri Dispan <juri.dispan@posteo.net>

* update-command: remove ".md" suffix in description

* update-command: enclosing positional parameters with angle brackets

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* update-command: enclose paremeters with double angle brackets

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* update-command: refine wording

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* update-command: remove unused functions

* update-command: detect tldr root from any subdir

* update-command: call place_placeholders directly

* update-command: add summary and compatibility to scripts/README.md

* scripts/update-command.py: remove unused method

* scripts/update-command.py: use logger.info instead of print

* scripts/update-command.py: rename command to cmd_example

* scripts/README.md: use command example instead of command

* scripts/update-command.py: remove nonexistent optional argument

* scripts/update-command.py: improve interactive example

* scripts/update-command.py: run black

---------

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
Co-authored-by: Juri Dispan <juri.dispan@posteo.net>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
This commit is contained in:
Vitor Henrique
2024-01-27 12:10:42 -03:00
committed by GitHub
parent eaea464e9a
commit 561a364e0d
2 changed files with 275 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ This section contains a summary of the scripts available in this directory. For
- [set-more-info-link.py](set-more-info-link.py) is a Python script to generate or update more information links across pages.
- [test.sh](test.sh) script runs some basic tests on every PR/commit to make sure that the pages are valid and that the code is formatted correctly.
- [wrong-filename.sh](wrong-filename.sh) script checks the consistency between the filenames and the page title.
- [update-command.py](update-command.py) is a Python script to update the common contents of a command example across all languages.
## Compatibility
@@ -29,3 +30,4 @@ The below table shows the compatibility of user-executable scripts with differen
| [set-alias-pages.py](set-alias-pages.py) | ✅ | ✅ | ✅ |
| [set-more-info-link.py](set-more-info-link.py) | ✅ | ✅ | ✅ |
| [wrong-filename.sh](wrong-filename.sh) | ✅ | ❌ | ❌ |
| [update-command.py](update-command.py) | ✅ | ✅ | ✅ |