avil13-co 2.1.6 → 2.2.1
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.
- package/dist/cli-commands/index.d.ts +3 -2
- package/dist/cli-commands/index.js +12 -6
- package/dist/commands/merge-branch.d.ts +1 -0
- package/dist/commands/merge-branch.js +16 -0
- package/dist/index.js +5 -0
- package/package.json +1 -1
- package/src/cli-commands/index.ts +16 -9
- package/src/commands/merge-branch.ts +16 -0
- package/src/index.ts +6 -0
|
@@ -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/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ const ask_1 = require("./ask");
|
|
|
4
4
|
const cli_commands_1 = require("./cli-commands");
|
|
5
5
|
const commands_1 = require("./commands");
|
|
6
6
|
const delete_barnch_1 = require("./commands/delete-barnch");
|
|
7
|
+
const merge_branch_1 = require("./commands/merge-branch");
|
|
7
8
|
const run = async () => {
|
|
8
9
|
const userWish = (0, cli_commands_1.getWishOfUser)();
|
|
9
10
|
if (cli_commands_1.Commands.Help === userWish) {
|
|
@@ -23,6 +24,10 @@ const run = async () => {
|
|
|
23
24
|
(0, delete_barnch_1.deleteBranch)(branch);
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
27
|
+
if (cli_commands_1.Commands.MergeBranch === userWish) {
|
|
28
|
+
(0, merge_branch_1.mergeBranch)(branch);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
26
31
|
await (0, commands_1.checkoutBranch)(branch);
|
|
27
32
|
await (0, commands_1.getCurrentBranchName)();
|
|
28
33
|
};
|
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
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ask } from './ask';
|
|
|
2
2
|
import { Commands, getHelp, getWishOfUser } from './cli-commands';
|
|
3
3
|
import { BranchesType, checkoutBranch, getBranches, getCurrentBranchName } from './commands';
|
|
4
4
|
import { deleteBranch } from './commands/delete-barnch';
|
|
5
|
+
import { mergeBranch } from './commands/merge-branch';
|
|
5
6
|
|
|
6
7
|
const run = async () => {
|
|
7
8
|
const userWish = getWishOfUser();
|
|
@@ -28,6 +29,11 @@ const run = async () => {
|
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
if (Commands.MergeBranch === userWish) {
|
|
33
|
+
mergeBranch(branch);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
31
37
|
await checkoutBranch(branch);
|
|
32
38
|
|
|
33
39
|
await getCurrentBranchName()
|