avil13-co 2.1.6 → 2.2.0
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.
|
@@ -2,8 +2,9 @@ export declare enum Commands {
|
|
|
2
2
|
Unknown = 0,
|
|
3
3
|
Help = 1,
|
|
4
4
|
DeleteBranch = 2,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
MergeBranch = 4,
|
|
6
|
+
ShowMerged = 8,
|
|
7
|
+
ShowUnMerged = 16
|
|
7
8
|
}
|
|
8
9
|
export declare const getWishOfUser: (firstArg?: string | undefined) => Commands;
|
|
9
10
|
export declare const getHelp: () => string;
|
|
@@ -7,8 +7,9 @@ var Commands;
|
|
|
7
7
|
Commands[Commands["Unknown"] = 0] = "Unknown";
|
|
8
8
|
Commands[Commands["Help"] = 1] = "Help";
|
|
9
9
|
Commands[Commands["DeleteBranch"] = 2] = "DeleteBranch";
|
|
10
|
-
Commands[Commands["
|
|
11
|
-
Commands[Commands["
|
|
10
|
+
Commands[Commands["MergeBranch"] = 4] = "MergeBranch";
|
|
11
|
+
Commands[Commands["ShowMerged"] = 8] = "ShowMerged";
|
|
12
|
+
Commands[Commands["ShowUnMerged"] = 16] = "ShowUnMerged";
|
|
12
13
|
})(Commands = exports.Commands || (exports.Commands = {}));
|
|
13
14
|
;
|
|
14
15
|
const getWishOfUser = (firstArg) => {
|
|
@@ -16,11 +17,13 @@ const getWishOfUser = (firstArg) => {
|
|
|
16
17
|
switch (true) {
|
|
17
18
|
case ['help', '-h', '--h', '--help'].includes(arg):
|
|
18
19
|
return Commands.Help;
|
|
20
|
+
case ['-M', 'merge'].includes(arg):
|
|
21
|
+
return Commands.MergeBranch;
|
|
19
22
|
case ['-D', 'rm'].includes(arg):
|
|
20
23
|
return Commands.DeleteBranch;
|
|
21
|
-
case ['
|
|
24
|
+
case ['-sm', '--show-merged'].includes(arg):
|
|
22
25
|
return Commands.ShowMerged;
|
|
23
|
-
case ['un', '--no-merged'].includes(arg):
|
|
26
|
+
case ['-un', '--no-merged'].includes(arg):
|
|
24
27
|
return Commands.ShowUnMerged;
|
|
25
28
|
default:
|
|
26
29
|
return Commands.Unknown;
|
|
@@ -36,10 +39,13 @@ OPTIONS:
|
|
|
36
39
|
help, -h, --h, --help
|
|
37
40
|
Showing this message
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
-M, merge
|
|
43
|
+
Merge branch
|
|
44
|
+
|
|
45
|
+
-sm, --show-merged
|
|
40
46
|
Showing merged branches
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
-un, --no-merged
|
|
43
49
|
Showing not merged branches
|
|
44
50
|
|
|
45
51
|
-D, rm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeBranch(branchName: string): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeBranch = void 0;
|
|
4
|
+
const exec_1 = require("./exec");
|
|
5
|
+
const color_1 = require("../color");
|
|
6
|
+
//
|
|
7
|
+
async function mergeBranch(branchName) {
|
|
8
|
+
if (!branchName) {
|
|
9
|
+
throw new Error('No branch...');
|
|
10
|
+
}
|
|
11
|
+
const checkoutCommand = `git merge ${branchName}`;
|
|
12
|
+
console.log(' ' + color_1.clc.green('git merge', branchName) + '\n');
|
|
13
|
+
const checkoutCommandResult = await (0, exec_1.exec)(checkoutCommand);
|
|
14
|
+
console.log(checkoutCommandResult);
|
|
15
|
+
}
|
|
16
|
+
exports.mergeBranch = mergeBranch;
|
package/package.json
CHANGED
|
@@ -3,11 +3,12 @@ import { clc } from '../color';
|
|
|
3
3
|
const args = process.argv.slice(2);
|
|
4
4
|
|
|
5
5
|
export enum Commands {
|
|
6
|
-
Unknown,
|
|
7
|
-
Help,
|
|
8
|
-
DeleteBranch,
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
Unknown = 0,
|
|
7
|
+
Help = 1,
|
|
8
|
+
DeleteBranch = 2,
|
|
9
|
+
MergeBranch = 4,
|
|
10
|
+
ShowMerged = 8,
|
|
11
|
+
ShowUnMerged = 16,
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export const getWishOfUser = (firstArg?: string): Commands => {
|
|
@@ -17,13 +18,16 @@ export const getWishOfUser = (firstArg?: string): Commands => {
|
|
|
17
18
|
case ['help', '-h', '--h', '--help'].includes(arg):
|
|
18
19
|
return Commands.Help;
|
|
19
20
|
|
|
21
|
+
case ['-M', 'merge'].includes(arg):
|
|
22
|
+
return Commands.MergeBranch;
|
|
23
|
+
|
|
20
24
|
case ['-D', 'rm'].includes(arg):
|
|
21
25
|
return Commands.DeleteBranch;
|
|
22
26
|
|
|
23
|
-
case ['
|
|
27
|
+
case ['-sm', '--show-merged'].includes(arg):
|
|
24
28
|
return Commands.ShowMerged;
|
|
25
29
|
|
|
26
|
-
case ['un', '--no-merged'].includes(arg):
|
|
30
|
+
case ['-un', '--no-merged'].includes(arg):
|
|
27
31
|
return Commands.ShowUnMerged;
|
|
28
32
|
|
|
29
33
|
default:
|
|
@@ -41,10 +45,13 @@ OPTIONS:
|
|
|
41
45
|
help, -h, --h, --help
|
|
42
46
|
Showing this message
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
-M, merge
|
|
49
|
+
Merge branch
|
|
50
|
+
|
|
51
|
+
-sm, --show-merged
|
|
45
52
|
Showing merged branches
|
|
46
53
|
|
|
47
|
-
|
|
54
|
+
-un, --no-merged
|
|
48
55
|
Showing not merged branches
|
|
49
56
|
|
|
50
57
|
-D, rm
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { exec } from './exec';
|
|
2
|
+
import { clc } from '../color';
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
export async function mergeBranch(branchName: string) {
|
|
6
|
+
if (!branchName) {
|
|
7
|
+
throw new Error('No branch...');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const checkoutCommand = `git merge ${branchName}`;
|
|
11
|
+
|
|
12
|
+
console.log(' ' + clc.green('git merge', branchName) + '\n');
|
|
13
|
+
|
|
14
|
+
const checkoutCommandResult = await exec(checkoutCommand);
|
|
15
|
+
console.log(checkoutCommandResult);
|
|
16
|
+
}
|