A command line interface version of Text Case.
Text Case is a text-transformation app for iOS, iPadOS, and macOS (by me). This project is essentially a subset of the functionality, made available as a command-line tool.
You can checkout this repository and build from scratch, or to make it slightly easier, it's also available as a custom Homebrew tap.
It's pretty easy:
- Check out the code.
- Run
swift build -c release
. - You'll find the executable in
.build/release/
.
Also, incredibly easy:
- Make sure you have Homebrew installed.
- Add the custom tap to your machine:
brew tap chrishannah/textcase
. - Install Text Case CLI:
brew install textcase
To update Text Case CLI via Homebrew, you'll first have to run brew update
to pull the latest changes from the tap, and if there's an update available, brew upgrade textcase
will update it to the
latest version.
You can use Text Case CLI via the textcase
command.
It is split into two separate subcommands, format
, and list-formats
.
You can see a list of the available formats, with textcase list-formats
. This will show the identifier that you'll need to provide when formatting text, and also a short description.
Help text
OVERVIEW: Lists all available formats.
USAGE: text-case list-formats
OPTIONS:
--version Show the version.
-h, --help Show help information.
You can format text with the format
subcommand. However, this is the default subcommand, so it can also be omitted, with the same result.
Input
Input text can be passed via STDIN, as a string with the input-text option, or from a file by passing the parth.
Output
The text is writted to STDOUT by default. But you can also specify a file that can be written to instead.
Help Text
OVERVIEW: Format text into a specified format.
USAGE: text-case format --format <format> [--input <input>] [--input-file <file>] [--output-file <file>]
OPTIONS:
-f, --format <format> Format to be used.
-i, --input <input> Text to be formatted.
--input-file <file> Path of file to be used as input.
--output-file <file> Path of file to be used as output.
--version Show the version.
-h, --help Show help information.