Bump is a command-line tool for managing and modifying values in multiple files using a configuration file (bump.cfg
). It supports various methods of identifying and modifying values, including tags, line/column positions, and regular expressions.
Ensure you have Python 3 installed. Place the script in a directory included in your system's PATH
and make it executable:
chmod +x bumpy/bump
cp bumpy/bump /usr/local/bin/bump
You can also just run the install.sh
script which should do the same in most cases.
bump init
Creates an empty bump.cfg
if it does not already exist.
Any bump command will use the bump.cfg file in the immediate directory, the future promises much more.
bump edit
Opens the bump.cfg
in your standard editor or nano.
bump add tag <name> <filepath> <tag> [options]
<name>
: Identifier for the entry inbump.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.-p, --padding <int>
: Number of whitespace-padding which gets added after tag and before end.
bump 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.-p, --padding <int>
: Amount of whitespace-padding which gets added after tag and before end.
bump add regex <name> <filepath> <regex> [options]
<regex>
: Regular expression to match values.- Options:
-f, --flags <flags>
: Optional flags for filtering.-g, --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.
bump 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.
bump 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.
bump remove <name>
Removes the specified entry from bump.cfg
.
-
Initialize Configuration:
bump init
-
Add a Tag-Based Entry:
bump add tag version ./config.txt VERSION= -w '"'
-
Get Values:
bump get
-
Set a New Value:
bump set "2.0.1"
-
Remove an Entry:
bump remove version