xshell 1.0.71 → 1.0.72

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/git.d.ts CHANGED
@@ -25,7 +25,10 @@ export declare class Git {
25
25
  hash: string;
26
26
  message: string;
27
27
  }[]>;
28
- fetch(print?: boolean): Promise<void>;
28
+ fetch({ print, remote }?: {
29
+ print?: boolean;
30
+ remote?: string;
31
+ }): Promise<void>;
29
32
  /** - branch?: `'main'` */
30
33
  checkout(branch?: 'main'): Promise<void>;
31
34
  checkout(branch?: string): Promise<void>;
@@ -45,4 +48,6 @@ export declare class Git {
45
48
  update(branch?: 'main'): Promise<void>;
46
49
  update(branch: string): Promise<void>;
47
50
  update(branch: string, remote?: string): Promise<void>;
51
+ /** - message?: stash description */
52
+ stash(message?: string): Promise<import("./process.js").CallResult<string>>;
48
53
  }
package/git.js CHANGED
@@ -76,8 +76,12 @@ export class Git {
76
76
  };
77
77
  });
78
78
  }
79
- async fetch(print = true) {
80
- await this.call(['fetch', '--all', '--prune'], { print: { code: false, command: false, stdout: true, stderr: true } });
79
+ async fetch({ print = true, remote } = {}) {
80
+ await this.call([
81
+ 'fetch',
82
+ remote || '--all',
83
+ '--prune'
84
+ ], { print: { code: false, command: false, stdout: true, stderr: true } });
81
85
  if (print)
82
86
  console.log('更新远程分支成功');
83
87
  }
@@ -152,10 +156,18 @@ export class Git {
152
156
  await this.checkout(target_branch);
153
157
  await this.merge(branch, true);
154
158
  }
155
- async update(branch = 'main', remote = 'origin') {
156
- await this.fetch();
159
+ async update(branch = 'main', remote) {
160
+ await this.fetch({ remote });
157
161
  await this.checkout(branch);
158
- await this.merge(`${remote}/${branch}`);
162
+ await this.merge(`${remote || 'origin'}/${branch}`);
163
+ }
164
+ /** - message?: stash description */
165
+ async stash(message) {
166
+ return this.call([
167
+ 'stash',
168
+ 'push',
169
+ ...message ? ['--message', message] : [],
170
+ ]);
159
171
  }
160
172
  }
161
173
  //# sourceMappingURL=git.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.0.71",
3
+ "version": "1.0.72",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -51,7 +51,7 @@ export declare class Lock<TResource = void> {
51
51
  }
52
52
  export declare function pause(milliseconds?: number): Promise<void>;
53
53
  /** 字符串字典序比较 */
54
- export declare function strcmp(l: string, r: string): 0 | 1 | -1;
54
+ export declare function strcmp(l: string, r: string): 1 | 0 | -1;
55
55
  /** 比较 1.10.02 这种版本号 */
56
56
  export declare function vercmp(l: string, r: string): number;
57
57
  export declare function get<TReturn = any>(obj: any, keypath: string): TReturn;
package/utils.d.ts CHANGED
@@ -22,7 +22,7 @@ export declare function unique<T>(iterable: T[] | Iterable<T>, selector?: string
22
22
  /** 排序对象中 key 的顺序,返回新的对象 */
23
23
  export declare function sort_keys<T>(obj: T): T;
24
24
  /** 字符串字典序比较 */
25
- export declare function strcmp(l: string, r: string): 0 | 1 | -1;
25
+ export declare function strcmp(l: string, r: string): 1 | 0 | -1;
26
26
  /** 比较 1.10.02 这种版本号 */
27
27
  export declare function vercmp(l: string, r: string): number;
28
28
  export declare function get<TReturn = any>(obj: any, keypath: string): TReturn;