-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
52 lines (40 loc) · 1.13 KB
/
index.ts
File metadata and controls
52 lines (40 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env node
import { NoArg } from 'noarg'
import { main } from './main.js'
const app = NoArg.create('openusage', {
description: 'CLI tool to see detailed opencode usage',
globalFlags: {
db: NoArg.string().description(
'Path to the opencode.db file. Overrides OPENCODE_DB_PATH environment variable'
),
},
})
const allProgram = app.create('all', {
description:
'Show detailed usage and cost per day, broken down by model and provider',
})
const modelProgram = app.create('model', {
description: 'Show usage and cost per day, broken down by model',
})
const totalProgram = app.create('total', {
description: 'Show total usage and cost per day',
})
const providerProgram = app.create('provider', {
description: 'Show usage and cost per day, broken down by provider',
})
app.on(([], flags) => {
void main('model', flags.db)
})
allProgram.on(([], flags) => {
void main('all', flags.db)
})
modelProgram.on(([], flags) => {
void main('model', flags.db)
})
totalProgram.on(([], flags) => {
void main('total', flags.db)
})
providerProgram.on(([], flags) => {
void main('provider', flags.db)
})
app.start()