jvcs 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env node
2
+
3
+ const yargs = require("yargs");
4
+ const { hideBin } = require("yargs/helpers");
5
+ const chalk = require("chalk");
6
+ const dotenv = require("dotenv")
7
+ dotenv.config()
8
+
9
+ const beginCmd = require("./controllers/begin")
10
+ const initCmd = require("./controllers/init")
11
+ const addCmd = require("./controllers/add")
12
+ const commitCmd = require("./controllers/commit")
13
+
14
+
15
+ yargs(hideBin(process.argv))
16
+ .scriptName("jvcs")
17
+ .command(
18
+ "begin",
19
+ chalk.blue("Initialize the Version Control System (login/signup).\n"),
20
+ {},
21
+ async () => {
22
+ try {
23
+ await beginCmd()
24
+ }
25
+ catch(error) {
26
+ console.log(chalk.red(error))
27
+ }
28
+ }
29
+ )
30
+ .command(
31
+ "init",
32
+ chalk.blue("Create an empty repository.\n"),
33
+ {},
34
+ async () => {
35
+ try {
36
+ await initCmd()
37
+ }
38
+ catch(error) {
39
+ console.log(chalk.red(error))
40
+ }
41
+ }
42
+ )
43
+ .command(
44
+ "add <paths...>",
45
+ chalk.blue(
46
+ `Add files or folders to the staging area.
47
+
48
+ Command | Description
49
+ ---------------------------------|-------------------
50
+ jvcs add . | all files/folders
51
+ jvcs add <file1> <file2> | multiple files
52
+ jvcs add <folder1> <folder2> | multiple folders
53
+ jvcs add <file> <folder> | files and folders\n`
54
+ ),
55
+ (yargs)=> {
56
+ return yargs.positional("paths", {
57
+ type: 'string',
58
+ describe: 'Files and folders to stage'
59
+ })
60
+ },
61
+ async (argv) => {
62
+ try {
63
+ await addCmd(argv.paths)
64
+ }
65
+ catch(error) {
66
+ console.log(chalk.red(error))
67
+ }
68
+ }
69
+ )
70
+ .command(
71
+ "commit <message>",
72
+ chalk.blue("Commit all the files/folders inside staging area\n"),
73
+ (yargs)=> {
74
+ return yargs.positional("message", {
75
+ type: 'string',
76
+ describe: 'Some message with your commit'
77
+ })
78
+ },
79
+ async (argv)=> {
80
+ try {
81
+ await commitCmd(argv.message)
82
+ }
83
+ catch(error) {
84
+ console.log(chalk.red(error))
85
+ }
86
+ }
87
+ )
88
+ // .command(
89
+ // "unstage <paths...>",
90
+ // chalk.blue(`
91
+ // Remove files and folders from staging area
92
+
93
+ // Command | Description
94
+ // ---------------------------------|-------------------
95
+ // jvcs unstage . | all files/folders
96
+ // jvcs unstage <file1> <file2> | multiple files
97
+ // jvcs unstage <folder1> <folder2> | multiple folders
98
+ // jvcs unstage <file> <folder> | files and folders\n
99
+ // `),
100
+ // (yargs)=> {
101
+ // return yargs.positional("paths", {
102
+ // type: 'string',
103
+ // describe: 'Files and folders to unstage'
104
+ // })
105
+ // },
106
+ // async (argv)=> {
107
+ // try {
108
+ // await unstageCmd(argv.paths)
109
+ // }
110
+ // catch(error) {
111
+ // console.log(chalk.red(error))
112
+ // }
113
+ // }
114
+ // )
115
+ // .command(
116
+ // "log",
117
+ // chalk.blue("show details of all commits"),
118
+ // {},
119
+ // async ()=> {
120
+ // try {
121
+ // await logCmd()
122
+ // }
123
+ // catch(error) {
124
+ // console.log(chalk.red(error))
125
+ // }
126
+ // }
127
+ // )
128
+ // .command(
129
+ // "push",
130
+ // chalk.blue("Push all the commits to remote"),
131
+ // {},
132
+ // async ()=> {
133
+ // try {
134
+ // await pushCmd()
135
+ // }
136
+ // catch(error) {
137
+ // console.log(chalk.red(error))
138
+ // }
139
+ // }
140
+ // )
141
+ // .command(
142
+ // "status",
143
+ // chalk.blue("Check status of each file/folder"),
144
+ // {},
145
+ // async ()=> {
146
+ // try {
147
+ // await statusCmd()
148
+ // }
149
+ // catch(error) {
150
+ // console.log(chalk.red(error))
151
+ // }
152
+ // }
153
+ // )
154
+ // .command(
155
+ // "revert <commitId>",
156
+ // chalk.blue("Replace your working directory with specific commit you made previously"),
157
+ // (yargs)=> {
158
+ // return yargs.positional("commitId", {
159
+ // type: 'string',
160
+ // describe: 'commitId to move your head'
161
+ // })
162
+ // },
163
+ // async (argv)=> {
164
+ // try {
165
+ // await revertCmd(argv.commitId)
166
+ // }
167
+ // catch(error) {
168
+ // console.log(chalk.red(error))
169
+ // }
170
+ // }
171
+ // )
172
+ // .command(
173
+ // "clone <path>",
174
+ // chalk.blue("Clone a remote repository to local"),
175
+ // (yargs)=> {
176
+ // return yargs.positional("path", {
177
+ // type:"string",
178
+ // describe:"path must be of the form username/reponame"
179
+ // })
180
+ // },
181
+ // async (argv)=> {
182
+ // try {
183
+ // const [username, reponame] = argv.path.split("/");
184
+ // await cloneCmd(username,reponame)
185
+ // }
186
+ // catch(error) {
187
+ // console.log(chalk.red(error || error.message))
188
+ // }
189
+ // }
190
+ // )
191
+ .demandCommand(1, chalk.yellow("You need at least one command"))
192
+ .help()
193
+ .parse();
194
+ // const unstageCmd = require("./controllers/unstage")
195
+ // const logCmd = require("./controllers/log");
196
+ // const pushCmd = require("./controllers/push");
197
+ // const statusCmd = require("./controllers/status")
198
+ // const revertCmd = require("./controllers/revert")
199
+ // const cloneCmd = require("./controllers/clone")
@@ -0,0 +1,199 @@
1
+ // const unstageCmd = require("./controllers/unstage")
2
+ // const logCmd = require("./controllers/log");
3
+ // const pushCmd = require("./controllers/push");
4
+ // const statusCmd = require("./controllers/status")
5
+ // const revertCmd = require("./controllers/revert")
6
+ // const cloneCmd = require("./controllers/clone")
7
+ #!/usr/bin/env node
8
+
9
+ const yargs = require("yargs");
10
+ const { hideBin } = require("yargs/helpers");
11
+ const chalk = require("chalk");
12
+ const dotenv = require("dotenv")
13
+ dotenv.config()
14
+
15
+ const beginCmd = require("./controllers/begin")
16
+ const initCmd = require("./controllers/init")
17
+ const addCmd = require("./controllers/add")
18
+ const commitCmd = require("./controllers/commit")
19
+
20
+
21
+ yargs(hideBin(process.argv))
22
+ .scriptName("jvcs")
23
+ .command(
24
+ "begin",
25
+ chalk.blue("Initialize the Version Control System (login/signup).\n"),
26
+ {},
27
+ async () => {
28
+ try {
29
+ await beginCmd()
30
+ }
31
+ catch(error) {
32
+ console.log(chalk.red(error))
33
+ }
34
+ }
35
+ )
36
+ .command(
37
+ "init",
38
+ chalk.blue("Create an empty repository.\n"),
39
+ {},
40
+ async () => {
41
+ try {
42
+ await initCmd()
43
+ }
44
+ catch(error) {
45
+ console.log(chalk.red(error))
46
+ }
47
+ }
48
+ )
49
+ .command(
50
+ "add <paths...>",
51
+ chalk.blue(
52
+ `Add files or folders to the staging area.
53
+
54
+ Command | Description
55
+ ---------------------------------|-------------------
56
+ jvcs add . | all files/folders
57
+ jvcs add <file1> <file2> | multiple files
58
+ jvcs add <folder1> <folder2> | multiple folders
59
+ jvcs add <file> <folder> | files and folders\n`
60
+ ),
61
+ (yargs)=> {
62
+ return yargs.positional("paths", {
63
+ type: 'string',
64
+ describe: 'Files and folders to stage'
65
+ })
66
+ },
67
+ async (argv) => {
68
+ try {
69
+ await addCmd(argv.paths)
70
+ }
71
+ catch(error) {
72
+ console.log(chalk.red(error))
73
+ }
74
+ }
75
+ )
76
+ .command(
77
+ "commit <message>",
78
+ chalk.blue("Commit all the files/folders inside staging area\n"),
79
+ (yargs)=> {
80
+ return yargs.positional("message", {
81
+ type: 'string',
82
+ describe: 'Some message with your commit'
83
+ })
84
+ },
85
+ async (argv)=> {
86
+ try {
87
+ await commitCmd(argv.message)
88
+ }
89
+ catch(error) {
90
+ console.log(chalk.red(error))
91
+ }
92
+ }
93
+ )
94
+ // .command(
95
+ // "unstage <paths...>",
96
+ // chalk.blue(`
97
+ // Remove files and folders from staging area
98
+
99
+ // Command | Description
100
+ // ---------------------------------|-------------------
101
+ // jvcs unstage . | all files/folders
102
+ // jvcs unstage <file1> <file2> | multiple files
103
+ // jvcs unstage <folder1> <folder2> | multiple folders
104
+ // jvcs unstage <file> <folder> | files and folders\n
105
+ // `),
106
+ // (yargs)=> {
107
+ // return yargs.positional("paths", {
108
+ // type: 'string',
109
+ // describe: 'Files and folders to unstage'
110
+ // })
111
+ // },
112
+ // async (argv)=> {
113
+ // try {
114
+ // await unstageCmd(argv.paths)
115
+ // }
116
+ // catch(error) {
117
+ // console.log(chalk.red(error))
118
+ // }
119
+ // }
120
+ // )
121
+ // .command(
122
+ // "log",
123
+ // chalk.blue("show details of all commits"),
124
+ // {},
125
+ // async ()=> {
126
+ // try {
127
+ // await logCmd()
128
+ // }
129
+ // catch(error) {
130
+ // console.log(chalk.red(error))
131
+ // }
132
+ // }
133
+ // )
134
+ // .command(
135
+ // "push",
136
+ // chalk.blue("Push all the commits to remote"),
137
+ // {},
138
+ // async ()=> {
139
+ // try {
140
+ // await pushCmd()
141
+ // }
142
+ // catch(error) {
143
+ // console.log(chalk.red(error))
144
+ // }
145
+ // }
146
+ // )
147
+ // .command(
148
+ // "status",
149
+ // chalk.blue("Check status of each file/folder"),
150
+ // {},
151
+ // async ()=> {
152
+ // try {
153
+ // await statusCmd()
154
+ // }
155
+ // catch(error) {
156
+ // console.log(chalk.red(error))
157
+ // }
158
+ // }
159
+ // )
160
+ // .command(
161
+ // "revert <commitId>",
162
+ // chalk.blue("Replace your working directory with specific commit you made previously"),
163
+ // (yargs)=> {
164
+ // return yargs.positional("commitId", {
165
+ // type: 'string',
166
+ // describe: 'commitId to move your head'
167
+ // })
168
+ // },
169
+ // async (argv)=> {
170
+ // try {
171
+ // await revertCmd(argv.commitId)
172
+ // }
173
+ // catch(error) {
174
+ // console.log(chalk.red(error))
175
+ // }
176
+ // }
177
+ // )
178
+ // .command(
179
+ // "clone <path>",
180
+ // chalk.blue("Clone a remote repository to local"),
181
+ // (yargs)=> {
182
+ // return yargs.positional("path", {
183
+ // type:"string",
184
+ // describe:"path must be of the form username/reponame"
185
+ // })
186
+ // },
187
+ // async (argv)=> {
188
+ // try {
189
+ // const [username, reponame] = argv.path.split("/");
190
+ // await cloneCmd(username,reponame)
191
+ // }
192
+ // catch(error) {
193
+ // console.log(chalk.red(error || error.message))
194
+ // }
195
+ // }
196
+ // )
197
+ .demandCommand(1, chalk.yellow("You need at least one command"))
198
+ .help()
199
+ .parse();
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env node
2
+
3
+ const yargs = require("yargs");
4
+ const { hideBin } = require("yargs/helpers");
5
+ const chalk = require("chalk");
6
+ const dotenv = require("dotenv")
7
+ dotenv.config()
8
+
9
+ const beginCmd = require("./controllers/begin")
10
+ const initCmd = require("./controllers/init")
11
+ const addCmd = require("./controllers/add")
12
+ const commitCmd = require("./controllers/commit")
13
+ // const unstageCmd = require("./controllers/unstage")
14
+ // const logCmd = require("./controllers/log");
15
+ // const pushCmd = require("./controllers/push");
16
+ // const statusCmd = require("./controllers/status")
17
+ // const revertCmd = require("./controllers/revert")
18
+ // const cloneCmd = require("./controllers/clone")
19
+
20
+
21
+ yargs(hideBin(process.argv))
22
+ .scriptName("jvcs")
23
+ .command(
24
+ "begin",
25
+ chalk.blue("Initialize the Version Control System (login/signup).\n"),
26
+ {},
27
+ async () => {
28
+ try {
29
+ await beginCmd()
30
+ }
31
+ catch(error) {
32
+ console.log(chalk.red(error))
33
+ }
34
+ }
35
+ )
36
+ .command(
37
+ "init",
38
+ chalk.blue("Create an empty repository.\n"),
39
+ {},
40
+ async () => {
41
+ try {
42
+ await initCmd()
43
+ }
44
+ catch(error) {
45
+ console.log(chalk.red(error))
46
+ }
47
+ }
48
+ )
49
+ .command(
50
+ "add <paths...>",
51
+ chalk.blue(
52
+ `Add files or folders to the staging area.
53
+
54
+ Command | Description
55
+ ---------------------------------|-------------------
56
+ jvcs add . | all files/folders
57
+ jvcs add <file1> <file2> | multiple files
58
+ jvcs add <folder1> <folder2> | multiple folders
59
+ jvcs add <file> <folder> | files and folders\n`
60
+ ),
61
+ (yargs)=> {
62
+ return yargs.positional("paths", {
63
+ type: 'string',
64
+ describe: 'Files and folders to stage'
65
+ })
66
+ },
67
+ async (argv) => {
68
+ try {
69
+ await addCmd(argv.paths)
70
+ }
71
+ catch(error) {
72
+ console.log(chalk.red(error))
73
+ }
74
+ }
75
+ )
76
+ .command(
77
+ "commit <message>",
78
+ chalk.blue("Commit all the files/folders inside staging area\n"),
79
+ (yargs)=> {
80
+ return yargs.positional("message", {
81
+ type: 'string',
82
+ describe: 'Some message with your commit'
83
+ })
84
+ },
85
+ async (argv)=> {
86
+ try {
87
+ await commitCmd(argv.message)
88
+ }
89
+ catch(error) {
90
+ console.log(chalk.red(error))
91
+ }
92
+ }
93
+ )
94
+ // .command(
95
+ // "unstage <paths...>",
96
+ // chalk.blue(`
97
+ // Remove files and folders from staging area
98
+
99
+ // Command | Description
100
+ // ---------------------------------|-------------------
101
+ // jvcs unstage . | all files/folders
102
+ // jvcs unstage <file1> <file2> | multiple files
103
+ // jvcs unstage <folder1> <folder2> | multiple folders
104
+ // jvcs unstage <file> <folder> | files and folders\n
105
+ // `),
106
+ // (yargs)=> {
107
+ // return yargs.positional("paths", {
108
+ // type: 'string',
109
+ // describe: 'Files and folders to unstage'
110
+ // })
111
+ // },
112
+ // async (argv)=> {
113
+ // try {
114
+ // await unstageCmd(argv.paths)
115
+ // }
116
+ // catch(error) {
117
+ // console.log(chalk.red(error))
118
+ // }
119
+ // }
120
+ // )
121
+ // .command(
122
+ // "log",
123
+ // chalk.blue("show details of all commits"),
124
+ // {},
125
+ // async ()=> {
126
+ // try {
127
+ // await logCmd()
128
+ // }
129
+ // catch(error) {
130
+ // console.log(chalk.red(error))
131
+ // }
132
+ // }
133
+ // )
134
+ // .command(
135
+ // "push",
136
+ // chalk.blue("Push all the commits to remote"),
137
+ // {},
138
+ // async ()=> {
139
+ // try {
140
+ // await pushCmd()
141
+ // }
142
+ // catch(error) {
143
+ // console.log(chalk.red(error))
144
+ // }
145
+ // }
146
+ // )
147
+ // .command(
148
+ // "status",
149
+ // chalk.blue("Check status of each file/folder"),
150
+ // {},
151
+ // async ()=> {
152
+ // try {
153
+ // await statusCmd()
154
+ // }
155
+ // catch(error) {
156
+ // console.log(chalk.red(error))
157
+ // }
158
+ // }
159
+ // )
160
+ // .command(
161
+ // "revert <commitId>",
162
+ // chalk.blue("Replace your working directory with specific commit you made previously"),
163
+ // (yargs)=> {
164
+ // return yargs.positional("commitId", {
165
+ // type: 'string',
166
+ // describe: 'commitId to move your head'
167
+ // })
168
+ // },
169
+ // async (argv)=> {
170
+ // try {
171
+ // await revertCmd(argv.commitId)
172
+ // }
173
+ // catch(error) {
174
+ // console.log(chalk.red(error))
175
+ // }
176
+ // }
177
+ // )
178
+ // .command(
179
+ // "clone <path>",
180
+ // chalk.blue("Clone a remote repository to local"),
181
+ // (yargs)=> {
182
+ // return yargs.positional("path", {
183
+ // type:"string",
184
+ // describe:"path must be of the form username/reponame"
185
+ // })
186
+ // },
187
+ // async (argv)=> {
188
+ // try {
189
+ // const [username, reponame] = argv.path.split("/");
190
+ // await cloneCmd(username,reponame)
191
+ // }
192
+ // catch(error) {
193
+ // console.log(chalk.red(error || error.message))
194
+ // }
195
+ // }
196
+ // )
197
+ .demandCommand(1, chalk.yellow("You need at least one command"))
198
+ .help()
199
+ .parse();