-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtslots.nim
More file actions
82 lines (67 loc) · 1.85 KB
/
Copy pathtslots.nim
File metadata and controls
82 lines (67 loc) · 1.85 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import std / assertions
import ".." / "src" / [smartcli]
var
nifcArgc {.importc: "cmdCount".}: int32
nifcArgv {.importc: "cmdLine".}: ptr UncheckedArray[cstring]
block:
nifcArgc = 6
let cargv = [
cstring"backup",
cstring"--mode=delta",
cstring"--output=backup.log",
cstring"run",
cstring"src",
cstring"dst"
]
nifcArgv = cast[ptr UncheckedArray[cstring]](cargv.addr)
let options = cliapp"""Backup v0.1
Copies files to a target.
Usage: backup [options] (run SOURCE DEST | version)
Commands:
run SOURCE DEST Start the backup
version Display version and quit
Arguments:
SOURCE Source path
DEST Destination path
Options:
--mode=full|delta Backup mode
--output=FILE Log file
-v, --verbose Enable verbose output
-h, --help Show this help and exit"""
assert options.source == "src"
assert options.dest == "dst"
assert options.output == "backup.log"
assert $options.mode == "cliModeDelta"
assert $options.command == "cmdRun"
block:
nifcArgc = 7
let cargv = [
cstring"backup",
cstring"run",
cstring"--mode=full",
cstring"src",
cstring"--output=after.log",
cstring"dst",
cstring"-v"
]
nifcArgv = cast[ptr UncheckedArray[cstring]](cargv.addr)
let options = cliapp"""Backup v0.1
Copies files to a target.
Usage: backup [options] (run SOURCE DEST | version)
Commands:
run SOURCE DEST Start the backup
version Display version and quit
Arguments:
SOURCE Source path
DEST Destination path
Options:
--mode=full|delta Backup mode
--output=FILE Log file
-v, --verbose Enable verbose output
-h, --help Show this help and exit"""
assert options.source == "src"
assert options.dest == "dst"
assert options.output == "after.log"
assert options.verbose
assert $options.mode == "cliModeFull"
assert $options.command == "cmdRun"