Skip to content

Commit baa6f3b

Browse files
committed
add examples, temporarily use git fork of cliui
Waiting on yargs/cliui#139 Re: yargs/cliui#138
1 parent 189c00a commit baa6f3b

File tree

7 files changed

+815
-612
lines changed

7 files changed

+815
-612
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
/.*
33

4+
!/examples
45
!typedoc.json
56
!tsconfig*.json
67
!.github

examples/git-tag.js

-82
This file was deleted.

examples/git-tag.ts

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import('../dist/mjs/index.js').then(({ jack }) => {
2+
const j = jack({
3+
usage: `
4+
git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]
5+
<tagname> [<commit> | <object>]
6+
or: git tag -d <tagname>...
7+
or: git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
8+
[--points-at <object>] [--column[=<options>] | --no-column]
9+
[--create-reflog] [--sort=<key>] [--format=<format>]
10+
[--merged <commit>] [--no-merged <commit>] [<pattern>...]
11+
or: git tag -v [--format=<format>] <tagname>...
12+
`,
13+
})
14+
.flag({
15+
list: {
16+
short: 'l',
17+
description: 'list tag names',
18+
},
19+
})
20+
.opt({
21+
n: {
22+
hint: 'n',
23+
description: 'print <n> lines of each tag message',
24+
},
25+
})
26+
.flag({
27+
delete: {
28+
short: 'd',
29+
description: 'delete tags',
30+
},
31+
})
32+
.flag({
33+
verify: {
34+
short: 'v',
35+
description: 'verify tags',
36+
negate: { hidden: true },
37+
},
38+
})
39+
.flag({
40+
help: {
41+
short: 'h',
42+
},
43+
})
44+
.description('Tag creation options')
45+
.flag({
46+
annotate: {
47+
short: 'a',
48+
description: 'annotated tag, needs a message',
49+
},
50+
})
51+
.opt({
52+
message: {
53+
short: 'm',
54+
hint: 'message',
55+
description: 'tag message',
56+
},
57+
file: {
58+
short: 'F',
59+
hint: 'file',
60+
description: 'read message from file',
61+
},
62+
})
63+
.flag({
64+
sign: {
65+
short: 's',
66+
description: 'annotated and GPG-signed tag',
67+
},
68+
})
69+
.opt({
70+
cleanup: {
71+
hint: 'mode',
72+
description: 'how to strip spaces and #comments from message',
73+
},
74+
'local-user': {
75+
short: 'u',
76+
hint: 'key-id',
77+
description: 'use another key to sign the tag',
78+
},
79+
})
80+
.flag({
81+
force: {
82+
short: 'f',
83+
description: 'replace the tag if exists',
84+
},
85+
})
86+
.description('Tag listing options')
87+
.opt({
88+
column: {
89+
hint: 'style',
90+
description: 'show tag list in columns',
91+
},
92+
sort: {
93+
hint: 'type',
94+
description: 'sort tags',
95+
},
96+
contains: {
97+
hint: 'commit',
98+
description: 'print only tags that contain the commit',
99+
},
100+
'points-at': {
101+
hint: 'object',
102+
description: 'print only tags of the object',
103+
},
104+
})
105+
const { values, positionals } = j.parse()
106+
if (values.help) console.log(j.usage())
107+
else console.log({ values, positionals })
108+
})

0 commit comments

Comments
 (0)