-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.ts
108 lines (101 loc) · 2.68 KB
/
cli.ts
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import Denomander from 'https://deno.land/x/[email protected]/mod.ts';
import { Core } from 'core/mod.ts';
const app = new Denomander({
app_name: 'octorg',
app_version: '1.0',
app_description: 'The best way to organize your github repos!',
});
app
.command('get [repo]', 'Clone the repo into the octorg path!')
.option('-g --github', 'Download with the github preset!')
.option('-n --nofast', 'Not clone with the depth flag')
.action(({ repo }: any) => {
let github;
if (typeof app.github == 'boolean') {
if (app.github == true) {
github = true;
} else {
github = false;
}
}
let nofast;
if (typeof app.nofast == 'boolean') {
if (app.nofast == true) {
nofast = false;
}
}
if (typeof repo == 'string') {
nofast = (typeof app.nofast == 'undefined') ? true : nofast;
Core.Git.Clone(repo, github, nofast);
}
});
app
.command('cd', 'Go to the path')
.option('-r --repo', 'Add the repo url for go more fast!')
.action(() => {
if (typeof app.repo == 'string') {
if (app.repo != ' ') {
Core.Dirs.Cd(app.repo);
}
}
Core.Dirs.Cd();
});
app
.command('info', 'Get the information about octorg tool')
.option('-v --version', 'Show the versions of the tools')
.option('-i --issue', 'Open the issue page for report bugs!')
.action(() => {
if (typeof app.version == 'boolean') {
if (app.version == true) {
Core.Info.Version();
}
}
if (typeof app.issue == 'boolean') {
if (app.issue == true) {
Core.Info.Issues();
}
}
});
app
.command('create [name]', 'Create a new repo managed by octorg!')
.option('-g --github', 'Init the repo with the github preset!')
.alias('init')
.action(({ name }: any) => {
let github;
if (typeof app.github == 'boolean') {
if (app.github == true) {
github = true;
} else {
github = false;
}
}
if (typeof name == 'string') {
Core.Create.InitRepo(name, github);
}
});
app
.command('delete [name]', 'Delete a new repo managed by octorg!')
.option('-g --github', 'Init the repo with the github preset!')
.alias('remove', 'rm')
.action(({ name }: any) => {
let github;
if (typeof app.github == 'boolean') {
if (app.github == true) {
github = true;
} else {
github = false;
}
}
if (typeof name == 'string') {
Core.Delete.RemoveRepo(name, github);
}
});
app
.command('list [name]', 'List the repos managed by octorg!')
.alias('get', 'repos')
.action(({ name }: any) => {
if (typeof name == 'string') {
Core.List.GetFolders(name);
}
});
app.parse(Deno.args);