CLI Tool for quickly updating values across your project/machine.
Project description
xet CLI Usage Guide
Overview
xet is a command-line tool for managing and modifying values in multiple files using a configuration file (.xet). It supports various methods of identifying and modifying values, including tags, line/column positions, and regular expressions.
Installation
pip install xet
or
pipx install xet
Commands
Initialize Configuration
xet init
- Options:
-g, --global: Global Mode. Creates a.xetfile in the XDG_CONFIG_HOME folder instead of locally.
Creates an empty .xet if it does not already exist.
Any xet command will use the .xet file in the immediate directory, unless the -g, --global flag is set, then the global .xet file will be used instead.
xet edit
- Options:
-g, --global: Edit the global.xetinstead of the local one.
Opens .xet in your standard editor or nano.
Add Entries to Configuration
Add a Tag-Based Entry
xet add tag <name> <filepath> <tag> [options]
<name>: Identifier for the entry inxet.cfg.<filepath>: Path to the target file.<tag>: The string identifying the line to modify.- Options:
-f, --flags <flags>: Optional flags for filtering.-w, --wrapper <char>: Wrap the value with a character (e.g., quotes), also gets stripped in get mode.-o, --occurences <index or slice>: Specify which occurrences to modify (string formatted like a list index in python, can be slices).-e, --end <str>: Will get appended in the line after value and wrappers, also gets stripped in get mode.-d, --padding <int>: Number of whitespace-padding which gets added after tag and before end.-p, --preset <str> <str>: Name and value of preset, option can be repeated to add multiple presets.-s, --ssh <str>: Hostname of ssh-host the file is found at, as found in openSSH config file.-g, --global: Add the entry to the global.xet.
Add a Line/Column-Based Entry
xet add lc <name> <filepath> <line> <column> [options]
<line>: Line number<column>: Column position after which the value is placed.- Options:
-f, --flags <flags>: Optional flags for filtering.-w, --wrapper <char>: Wrap the value with a character (e.g., quotes), also gets stripped in get mode.-e, --end <str>: Will get appended in the line after value and wrappers, also gets stripped in get mode.-d, --padding <int>: Amount of whitespace-padding which gets added after tag and before end.-p, --preset <str> <str>: Name and value of preset, option can be repeated to add multiple presets.-s, --ssh <str>: Hostname of ssh-host the file is found at, as found in openSSH config file.-g, --global: Add the entry to the global.xet.
Add a Regex-Based Entry
xet add regex <name> <filepath> <regex> [options]
<regex>: Regular expression to match values.- Options:
-f, --flags <flags>: Optional flags for filtering.-c, --capture-group <int>: Capture group number to update.-o, --occurences <index or slice>: Specify which occurrences to modify (string formatted like a list index in python, can be slices).-w, --wrapper <char>: Wrap the value with a character (e.g., quotes), also gets stripped in get mode.-p, --preset <str> <str>: Name and value of preset, option can be repeated to add multiple presets.-s, --ssh <str>: Hostname of ssh-host the file is found at, as found in openSSH config file.-g, --global: Add the entry to the global.xet.
Get Values from Configured Files
xet get [-e <flags>] [-o <flags>] [-n <names>]
Options:
-e, --except <flags>: Exclude entries with specified flags.-o, --only <flags>: Include only entries with specified flags.-n, --names <names>: Include only entries with specified names.-g, --global: Use the global.xet.
Set Values in Configured Files
xet set <value> [-e <flags>] [-o <flags>] [-n <names>]
<value>: The new value to be set. Options:-e, --except <flags>: Exclude entries with specified flags.-o, --only <flags>: Include only entries with specified flags.-n, --names <names>: Include only entries with specified names.-g, --global: Use the global.xet.
Set Values to Preset
xet preset <preset>
<preset>: Name of the preset to be set.- Options:
-g, --global: Use the global.xet.
Remove an Entry
xet remove <name>
<name>: Name of the entry to be removed.- Options:
-g, --global: Remove the specified entry from the global.xet.
Removes the specified entry from .xet file.
Example Usage
-
Initialize Configuration:
xet init -
Add a Tag-Based Entry:
xet add tag version ./config.txt VERSION= -w '"'
-
Get Values:
xet get -
Set a New Value:
xet set "2.0.1"
-
Remove an Entry:
xet remove version
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xet-1.0.0-py3-none-any.whl.
File metadata
- Download URL: xet-1.0.0-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0634eb86bb2c00eeb5334e846d7995bd7787ce3e51f2ea361d71910f18c2dd14
|
|
| MD5 |
114fa082a653c7c7002e1ee67b6758b4
|
|
| BLAKE2b-256 |
0d57480388c23caa104a1c33352be18da8922645cf232c82bdf4cfeafddf234d
|
Provenance
The following attestation bundles were made for xet-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on GeraldIr/xet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xet-1.0.0-py3-none-any.whl -
Subject digest:
0634eb86bb2c00eeb5334e846d7995bd7787ce3e51f2ea361d71910f18c2dd14 - Sigstore transparency entry: 257919769
- Sigstore integration time:
-
Permalink:
GeraldIr/xet@00a553fdc1a027c139ffb18dfc9929a65e14fccf -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/GeraldIr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@00a553fdc1a027c139ffb18dfc9929a65e14fccf -
Trigger Event:
release
-
Statement type: