@nu-art/commando 0.400.4 → 0.400.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/commando",
3
- "version": "0.400.4",
3
+ "version": "0.400.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -29,7 +29,7 @@
29
29
  "build": "tsc"
30
30
  },
31
31
  "dependencies": {
32
- "@nu-art/ts-common": "0.400.4"
32
+ "@nu-art/ts-common": "0.400.6"
33
33
  },
34
34
  "unitConfig": {
35
35
  "type": "typescript-lib"
@@ -38,6 +38,7 @@ export declare class Commando_Basic extends BaseCommando {
38
38
  */
39
39
  ls(params?: string): this;
40
40
  mkdir(dirName: string): this;
41
+ rm(dirPath: string, options?: Cli_RmdirOptions): this;
41
42
  rmdir(dirPath: string, options?: Cli_RmdirOptions): this;
42
43
  cpdir(srcPath: string, destPath: string, options?: Cli_CpdirOptions): this;
43
44
  cat(fileName: string): this;
@@ -44,12 +44,17 @@ export class Commando_Basic extends BaseCommando {
44
44
  this.append(`mkdir -p ${dirName}`);
45
45
  return this;
46
46
  }
47
- rmdir(dirPath, options) {
47
+ rm(dirPath, options) {
48
48
  let command = 'rm';
49
49
  if (options?.force)
50
- command += ' -rf';
51
- if (options?.recursive)
52
- command += ' -r';
50
+ command += ' -f';
51
+ this.append(`${command} ${dirPath}`);
52
+ return this;
53
+ }
54
+ rmdir(dirPath, options) {
55
+ let command = 'rm -r';
56
+ if (options?.force)
57
+ command += ' -f';
53
58
  this.append(`${command} ${dirPath}`);
54
59
  return this;
55
60
  }
@@ -14,7 +14,7 @@ type GitPushParams = {
14
14
  force?: boolean;
15
15
  };
16
16
  export declare class Commando_Git extends Super {
17
- git: {
17
+ git(): {
18
18
  clone: (url: string, options?: GitCloneParams) => this;
19
19
  checkout: (branch: string) => this;
20
20
  createTag: (tagName: string) => this;
@@ -34,21 +34,21 @@ export declare class Commando_Git extends Super {
34
34
  status: () => this;
35
35
  };
36
36
  git_clone(url: string, options?: GitCloneParams): this;
37
- private git_checkout;
38
- private git_createTag;
39
- private git_gitCommit;
40
- private git_add;
41
- private git_addAll;
42
- private git_addAndCommit;
43
- private git_push;
44
- private git_pushTags;
45
- private git_fetch;
46
- private git_resetHard;
47
- private git_getCurrentBranch;
48
- private git_pull;
49
- private git_merge;
50
- private git_createBranch;
51
- private git_gsui;
52
- private git_status;
37
+ git_checkout(branch: string): this;
38
+ git_createTag(tagName: string): this;
39
+ git_gitCommit(commitMessage: string): this;
40
+ git_add(file: string): this;
41
+ git_addAll(): this;
42
+ git_addAndCommit(commitMessage: string): this;
43
+ git_push(options?: GitPushParams): this;
44
+ git_pushTags(): this;
45
+ git_fetch(): this;
46
+ git_resetHard(tag?: string): this;
47
+ git_getCurrentBranch(): this;
48
+ git_pull(params: string): this;
49
+ git_merge(mergeFrom: string): this;
50
+ git_createBranch(branch: string): this;
51
+ git_gsui(modules?: string): this;
52
+ git_status(): this;
53
53
  }
54
54
  export {};
@@ -4,32 +4,34 @@ import { MergeClass } from '../core/class-merger.js';
4
4
  import { BaseCommando } from '../core/BaseCommando.js';
5
5
  const Super = MergeClass(BaseCommando, Commando_Programming, Commando_Basic);
6
6
  export class Commando_Git extends Super {
7
- git = {
8
- clone: this.git_clone,
9
- checkout: this.git_checkout,
10
- createTag: this.git_createTag,
11
- gitCommit: this.git_gitCommit,
12
- add: this.git_add,
13
- addAll: this.git_addAll,
14
- addAndCommit: this.git_addAndCommit,
15
- push: this.git_push,
16
- pushTags: this.git_pushTags,
17
- fetch: this.git_fetch,
18
- resetHard: this.git_resetHard,
19
- getCurrentBranch: this.git_getCurrentBranch,
20
- pull: this.git_pull,
21
- merge: this.git_merge,
22
- createBranch: this.git_createBranch,
23
- gsui: this.git_gsui,
24
- status: this.git_status,
25
- };
7
+ git() {
8
+ return {
9
+ clone: this.git_clone,
10
+ checkout: this.git_checkout,
11
+ createTag: this.git_createTag,
12
+ gitCommit: this.git_gitCommit,
13
+ add: this.git_add,
14
+ addAll: this.git_addAll,
15
+ addAndCommit: this.git_addAndCommit,
16
+ push: this.git_push,
17
+ pushTags: this.git_pushTags,
18
+ fetch: this.git_fetch,
19
+ resetHard: this.git_resetHard,
20
+ getCurrentBranch: this.git_getCurrentBranch,
21
+ pull: this.git_pull,
22
+ merge: this.git_merge,
23
+ createBranch: this.git_createBranch,
24
+ gsui: this.git_gsui,
25
+ status: this.git_status,
26
+ };
27
+ }
28
+ ;
26
29
  git_clone(url, options) {
27
30
  const branch = `${options?.branch ? ` -b ${options?.branch}` : ''}`;
28
31
  const recursive = `${options?.recursive ? ` --recursive` : ''}`;
29
32
  const outputFolder = `${options?.outputFolder ? ` ${options.outputFolder}` : ''}`;
30
33
  const command = `git clone${recursive}${branch} ${url}${outputFolder}`;
31
- this.append(command);
32
- return this;
34
+ return this.append(command);
33
35
  }
34
36
  // git_cloneAssert(url: string, options?: GitCloneParams) {
35
37
  // return new Promise<void>((resolve, reject) => {
@@ -51,68 +53,52 @@ export class Commando_Git extends Super {
51
53
  // });
52
54
  // }
53
55
  git_checkout(branch) {
54
- this.append(`git checkout ${branch}`);
55
- return this;
56
+ return this.append(`git checkout ${branch}`);
56
57
  }
57
58
  git_createTag(tagName) {
58
- this.append(`git tag -f ${tagName}`);
59
- return this;
59
+ return this.append(`git tag -f ${tagName}`);
60
60
  }
61
61
  git_gitCommit(commitMessage) {
62
- this.append(`git commit -m "${commitMessage}"`);
63
- return this;
62
+ return this.append(`git commit -m "${commitMessage}"`);
64
63
  }
65
64
  git_add(file) {
66
- this.append(`git add "${file}"`);
67
- return this;
65
+ return this.append(`git add "${file}"`);
68
66
  }
69
67
  git_addAll() {
70
- this.append(`git add .`);
71
- return this;
68
+ return this.append(`git add .`);
72
69
  }
73
70
  git_addAndCommit(commitMessage) {
74
- this.append(`git commit -am "${commitMessage}"`);
75
- return this;
71
+ return this.append(`git commit -am "${commitMessage}"`);
76
72
  }
77
73
  git_push(options) {
78
- this.append(`git push ${options?.remote} ${options?.branch}`);
79
- return this;
74
+ return this.append(`git push ${options?.remote ?? ''} ${options?.branch ?? ''}`);
80
75
  }
81
76
  git_pushTags() {
82
- this.append('git push --tags --force');
83
- return this;
77
+ return this.append('git push --tags --force');
84
78
  }
85
79
  git_fetch() {
86
- this.append('git fetch');
87
- return this;
80
+ return this.append('git fetch');
88
81
  }
89
82
  git_resetHard(tag = '') {
90
- this.append('git reset --hard ${tag}');
91
- return this;
83
+ return this.append('git reset --hard ${tag}');
92
84
  }
93
85
  git_getCurrentBranch() {
94
- this.append('git status | grep "On branch" | sed -E "s');
95
- return this;
86
+ return this.append('git status | grep "On branch" | sed -E "s');
96
87
  }
97
88
  git_pull(params) {
98
- this.append('git pull ${params}');
99
- return this;
89
+ return this.append('git pull ${params}');
100
90
  }
101
91
  git_merge(mergeFrom) {
102
- this.append(`git merge ${mergeFrom}`);
103
- return this;
92
+ return this.append(`git merge ${mergeFrom}`);
104
93
  }
105
94
  git_createBranch(branch) {
106
- this.append(`git checkout - b ${branch}`);
107
- this.append(`git push-- set -upstream origin ${branch}`);
108
- return this;
95
+ return this.append(`git checkout - b ${branch}`)
96
+ .append(`git push-- set -upstream origin ${branch}`);
109
97
  }
110
98
  git_gsui(modules = '') {
111
- this.append('git submodule update --recursive --init ${modules}');
112
- return this;
99
+ return this.append('git submodule update --recursive --init ${modules}');
113
100
  }
114
101
  git_status() {
115
- this.append('git status');
116
- return this;
102
+ return this.append('git status');
117
103
  }
118
104
  }