sheetjs/packages/ssf-cli
2022-03-09 06:28:19 -05:00
..
bin CLI refactor 2020-06-24 12:45:39 -07:00
.gitignore CLI refactor 2020-06-24 12:45:39 -07:00
.npmignore ssf-cli 1.0.1 [ci skip] 2020-06-27 20:21:36 -04:00
index.js ssf-cli 1.0.1 [ci skip] 2020-06-27 20:21:36 -04:00
package.json ssf repo reorg 2022-03-09 06:28:19 -05:00
README.md ssf-cli 1.0.1 [ci skip] 2020-06-27 20:21:36 -04:00

SSF Command-Line Interface

ssf (SpreadSheet Format) is a pure JS library to format data using ECMA-376 spreadsheet format codes (used in popular spreadsheet software packages).

This CLI tool formats numbers from shell scripts and other command-line tools.

Installation

With npm:

$ npm install -g ssf-cli

Usage

ssf-cli takes two arguments: the format string and the value to be formatted.

The value is formatted twice, once interpreting the value as a string and once interpreting the value as a number, and both results are printed to standard output, with a pipe character | after each value:

$ bin/ssf.njs "#,##0.00" 12345
12345|12,345.00|
$ bin/ssf.njs "0;0;0;:@:" 12345
:12345:|12345|

Extracting the values in a pipeline is straightforward with AWK:

$ bin/ssf.njs "#,##0.00" 12345 | awk -F\| '{print $2}'
12,345.00

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 license are reserved by the Original Author.

Credits

Special thanks to Garrett Luu for spinning off the command from the SSF module.

Analytics