Skip to content

A command-line business transaction data (BTD) parser.

License

Notifications You must be signed in to change notification settings

companieshouse/btd-cli

Repository files navigation

btd-cli

A simple command-line tool for displaying business transaction data (BTD) in a human-readable format.

btd-cli

Installation

Using Homebrew:

$ brew tap companieshouse/homebrew-ch
$ brew install btd-cli

Alternatively:

$ go install github.com/companieshouse/btd-cli@latest

Usage

btd-cli commands use the following structure:

$ btd-cli <command> [subcommand] [flags and arguments]

To display global, command, or subcommand usage information, use one of the following:

$ btd-cli help
$ btd-cli help <command>
$ btd-cli help <command> <subcommand>

btd-cli also support the --help flag (and its shortened form -h) as an alternative to the help command:

$ btd-cli --help
$ btd-cli <command> --help
$ btd-cli <command> <subcommand> --help

Parsing Data

The parse command supports multiple subcommands for parsing business transaction data from different sources. These include string and file subcommands, which are described in more detail below.

Parsing data strings

Use the string subcommand to parse business transaction data from a command-line argument string (quotes are required):

btd-cli parse string '...'

Parsing data files

Use the file subcommand to parse business transaction data from an input file. Each non-empty line of the input file is assumed to contain a complete transaction and is parsed and output independently of any other:

btd-cli parse file <path>

Global Flags

btd-cli supports the following global flags:

Flag Description Default
-c, --config Config file path; see Configuration File $HOME/.btd-cli.toml
-t, --tag-map Path to the tag map file tagmap.dat

Configuration File

btd-cli will read its settings from a TOML format configuration file at $HOME/.btd-cli.toml if one exists. Configuration file settings always take precedence over built-in defaults, and command-line flags always take precedence over both configuration file settings and built-in defaults. The configuration file path can be changed using the --config flag (or its shortened form -c); see Global Flags.

The following configuration file settings are supported:

Name Description
tag-map Path to the tag map file ($var and ${var} style environment variables will be expanded)

For example, to set a default path for the tag map in the configuration file:

tag-map = '$HOME/projects/chl-tuxedo/chtuxgw/config/tagmap.dat'

Updating the example gif image

To update the example btd-cli.gif image used in this README.md file using VHS:

  • Modify the btd-cli.tape configuration file if needed
  • Run vhs < btd-cli.tape
  • Commit the updated btd-cli.gif (and btd-cli.tape configuration file if modified) to source control

License

This project is subject to the terms of the MIT License.