Skip to content

Commit c361c93

Browse files
committed
add command description
1 parent d8dd691 commit c361c93

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ you can download a binary release
5656
```sh
5757
# Install with wget or curl
5858
## set the latest version on releases.
59-
VERSION=v1.0.20
59+
VERSION=v1.0.21
6060
## case you use wget
6161
wget https://github.com/solaoi/colc/releases/download/$VERSION/colc_linux_amd64.tar.gz
6262
## case you use curl

colc.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@ import {
77
import { runner } from "./lib/common.ts";
88
import { parse } from "https://deno.land/std@0.66.0/flags/mod.ts";
99

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);
1125
const [column, filename] = _;
1226
const hasTwoColumn = (() => {
1327
if (typeof column !== "string") return false;
@@ -18,10 +32,20 @@ const hasTwoColumn = (() => {
1832
Number.isInteger(parseInt(columns[1]));
1933
})();
2034

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+
2145
if (
2246
(typeof column !== "number" && !hasTwoColumn) || typeof filename !== "string"
2347
) {
24-
console.log("Usage:\n colc [column] [file.csv|tsv|txt]");
48+
console.log(colcDescription);
2549
Deno.exit(1);
2650
}
2751
const awkPrecision: number = (() => {

0 commit comments

Comments
 (0)