Skip to content
/ bump Public

Bump is a CLI tool allowing you to bump (get/set) multiple values across your projects with a single command.

License

Notifications You must be signed in to change notification settings

GeraldIr/bump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bump CLI Usage Guide

Overview

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.

Installation

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.

Commands

Initialize Configuration

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.

Add Entries to Configuration

Add a Tag-Based Entry

bump add tag <name> <filepath> <tag> [options]
  • <name>: Identifier for the entry in bump.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.

Add a Line/Column-Based Entry

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.

Add a Regex-Based Entry

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.

Get Values from Configured Files

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.

Set Values in Configured Files

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.

Remove an Entry

bump remove <name>

Removes the specified entry from bump.cfg.

Example Usage

  1. Initialize Configuration:

    bump init
  2. Add a Tag-Based Entry:

    bump add tag version ./config.txt VERSION= -w '"'
  3. Get Values:

    bump get
  4. Set a New Value:

    bump set "2.0.1"
  5. Remove an Entry:

    bump remove version

About

Bump is a CLI tool allowing you to bump (get/set) multiple values across your projects with a single command.

Resources

License

Stars

Watchers

Forks

Packages

No packages published