@@ -7,7 +7,21 @@ import {
7
7
import { runner } from "./lib/common.ts" ;
8
8
import { parse } from "https://deno.land/std@0.66.0/flags/mod.ts" ;
9
9
10
- const { _, binsize, b, filter, f, check, c, precision, p } = parse ( Deno . args ) ;
10
+ const colcVersion = "v1.0.21"
11
+ const colcDescription = `Complete documentation is available at https://github.com/solaoi/colc
12
+
13
+ Usage:
14
+ colc [column] [file.csv|tsv|txt]
15
+
16
+ Options:
17
+ -c,--check : check the column is valid
18
+ -p,--precision <number> : set precision, default is 6
19
+ -b,--binsize <number> : show frequency table and histogram
20
+ -f,--filter <number(1-99)> : with binsize option, filter frequency
21
+ -v,--version : show version
22
+ -h,--help : show help`
23
+
24
+ const { _, binsize, b, filter, f, check, c, precision, p, help, h, version, v } = parse ( Deno . args ) ;
11
25
const [ column , filename ] = _ ;
12
26
const hasTwoColumn = ( ( ) => {
13
27
if ( typeof column !== "string" ) return false ;
@@ -18,10 +32,20 @@ const hasTwoColumn = (() => {
18
32
Number . isInteger ( parseInt ( columns [ 1 ] ) ) ;
19
33
} ) ( ) ;
20
34
35
+ if ( h !== undefined || help !== undefined ) {
36
+ console . log ( colcDescription ) ;
37
+ Deno . exit ( 0 ) ;
38
+ }
39
+
40
+ if ( v !== undefined || version !== undefined ) {
41
+ console . log ( colcVersion ) ;
42
+ Deno . exit ( 0 ) ;
43
+ }
44
+
21
45
if (
22
46
( typeof column !== "number" && ! hasTwoColumn ) || typeof filename !== "string"
23
47
) {
24
- console . log ( "Usage:\n colc [column] [file.csv|tsv|txt]" ) ;
48
+ console . log ( colcDescription ) ;
25
49
Deno . exit ( 1 ) ;
26
50
}
27
51
const awkPrecision : number = ( ( ) => {
0 commit comments