File tree Expand file tree Collapse file tree 4 files changed +79
-15
lines changed Expand file tree Collapse file tree 4 files changed +79
-15
lines changed Original file line number Diff line number Diff line change 1+ * .tgz
Original file line number Diff line number Diff line change 1+ # [ SSF Command-Line Interface] ( http://sheetjs.com )
2+
3+ ssf (SpreadSheet Format) is a pure JS library to format data using ECMA-376
4+ spreadsheet format codes (used in popular spreadsheet software packages).
5+
6+ This CLI tool formats numbers from shell scripts and other command-line tools.
7+
8+ ## Installation
9+
10+ With [ npm] ( https://www.npmjs.org/package/ssf-cli ) :
11+
12+ ``` bash
13+ $ npm install -g ssf-cli
14+ ```
15+
16+ ## Usage
17+
18+ ` ssf-cli ` takes two arguments: the format string and the value to be formatted.
19+
20+ The value is formatted twice, once interpreting the value as a string and once
21+ interpreting the value as a number, and both results are printed to standard
22+ output, with a pipe character ` | ` after each value:
23+
24+ ``` bash
25+ $ bin/ssf.njs " #,##0.00" 12345
26+ 12345| 12,345.00|
27+ $ bin/ssf.njs " 0;0;0;:@:" 12345
28+ :12345:| 12345|
29+ ```
30+
31+ Extracting the values in a pipeline is straightforward with AWK:
32+
33+ ``` bash
34+ $ bin/ssf.njs " #,##0.00" 12345 | awk -F\| ' {print $2}'
35+ 12,345.00
36+ ```
37+
38+ ## License
39+
40+ Please consult the attached LICENSE file for details. All rights not explicitly
41+ granted by the Apache 2.0 license are reserved by the Original Author.
42+
43+ ## Credits
44+
45+ Special thanks to [ Garrett Luu] ( https://garrettluu.com/ ) for spinning off the
46+ command from the SSF module.
47+
48+ [ ![ Analytics] ( https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/ssf?pixel )] ( https://github.com/SheetJS/ssf )
Original file line number Diff line number Diff line change 1- #!/usr/bin/env node
21/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */
32/* eslint-env node */
43/* eslint no-console:0 */
@@ -7,11 +6,11 @@ var X = require('ssf');
76function run ( ) {
87 var argv = process . argv . slice ( 2 ) ;
98 if ( argv . length < 2 || argv [ 0 ] == "-h" || argv [ 0 ] == "--help" ) {
10- console . error ( "usage: ssf <format> <value>" ) ;
9+ console . error ( "usage: ssf-cli <format> <value>" ) ;
1110 console . error ( "output: format_as_string|format_as_number|" ) ;
1211 process . exit ( 0 ) ;
1312 }
1413 console . log ( X . format ( argv [ 0 ] , argv [ 1 ] ) + "|" + X . format ( argv [ 0 ] , + ( argv [ 1 ] ) ) + "|" ) ;
1514}
1615
17- module . exports = run ;
16+ module . exports = run ;
Original file line number Diff line number Diff line change 11{
2- "name" : " ssf-cli" ,
3- "version" : " 1.0.0" ,
4- "description" : " Command-line interface for ssf" ,
5- "bin" : {
6- "ssf-cli" : " ./bin/ssf.njs"
7- },
8- "main" : " index.js" ,
9- "author" : " Garrett Luu" ,
10- "license" : " Apache-2.0" ,
11- "dependencies" : {
12- "ssf" : " ^0.11.1"
13- }
2+ "name" : " ssf-cli" ,
3+ "version" : " 1.0.1" ,
4+ "author" : " Garrett Luu" ,
5+ "description" : " Command-line interface for ssf" ,
6+ "keywords" : [
7+ " format" ,
8+ " sprintf" ,
9+ " spreadsheet"
10+ ],
11+ "main" : " ./index.js" ,
12+ "bin" : {
13+ "ssf-cli" : " ./bin/ssf.njs"
14+ },
15+ "dependencies" : {
16+ "ssf" : " ^0.11.2"
17+ },
18+ "repository" : {
19+ "type" : " git" ,
20+ "url" : " git://github.com/SheetJS/ssf.git"
21+ },
22+ "homepage" : " http://sheetjs.com/" ,
23+ "bugs" : {
24+ "url" : " https://github.com/SheetJS/ssf/issues"
25+ },
26+ "license" : " Apache-2.0" ,
27+ "engines" : {
28+ "node" : " >=0.8"
29+ }
1430}
You can’t perform that action at this time.
0 commit comments