@optique/git 0.9.0-dev.215 → 0.9.0-dev.227
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/index.cjs +157 -225
- package/dist/index.d.cts +81 -103
- package/dist/index.d.ts +81 -103
- package/dist/index.js +157 -225
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,55 +1,16 @@
|
|
|
1
1
|
import { ValueParser } from "@optique/core/valueparser";
|
|
2
|
+
import { Message } from "@optique/core/message";
|
|
2
3
|
import { NonEmptyString } from "@optique/core/nonempty";
|
|
3
4
|
import { expandOid, listBranches, listRemotes, listTags, readObject, resolveRef } from "isomorphic-git";
|
|
4
5
|
|
|
5
6
|
//#region src/index.d.ts
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
* Interface for FileSystem operations required by git parsers.
|
|
9
|
-
* This allows custom filesystem implementations for different environments.
|
|
10
|
-
*
|
|
11
|
-
* @since 0.9.0
|
|
12
|
-
*/
|
|
13
|
-
interface FileSystem {
|
|
14
|
-
readFile(path: string): Promise<Uint8Array | string>;
|
|
15
|
-
writeFile(path: string, data: Uint8Array | string): Promise<void>;
|
|
16
|
-
mkdir(path: string, options?: {
|
|
17
|
-
recursive?: boolean;
|
|
18
|
-
}): Promise<void>;
|
|
19
|
-
rmdir(path: string, options?: {
|
|
20
|
-
recursive?: boolean;
|
|
21
|
-
}): Promise<void>;
|
|
22
|
-
unlink(path: string): Promise<void>;
|
|
23
|
-
readdir(path: string): Promise<string[]>;
|
|
24
|
-
lstat(path: string): Promise<{
|
|
25
|
-
isSymbolicLink(): boolean;
|
|
26
|
-
isDirectory(): boolean;
|
|
27
|
-
isFile(): boolean;
|
|
28
|
-
}>;
|
|
29
|
-
stat(path: string): Promise<{
|
|
30
|
-
isSymbolicLink(): boolean;
|
|
31
|
-
isDirectory(): boolean;
|
|
32
|
-
isFile(): boolean;
|
|
33
|
-
}>;
|
|
34
|
-
readlink(path: string): Promise<string>;
|
|
35
|
-
symlink(target: string, path: string): Promise<void>;
|
|
36
|
-
chmod(path: string, mode: number): Promise<void>;
|
|
37
|
-
chown(path: string, uid: number, gid: number): Promise<void>;
|
|
38
|
-
rename(oldPath: string, newPath: string): Promise<void>;
|
|
39
|
-
copyFile(srcPath: string, destPath: string): Promise<void>;
|
|
40
|
-
exists(path: string): Promise<boolean>;
|
|
41
|
-
}
|
|
42
8
|
/**
|
|
43
9
|
* Options for creating git value parsers.
|
|
44
10
|
*
|
|
45
11
|
* @since 0.9.0
|
|
46
12
|
*/
|
|
47
13
|
interface GitParserOptions {
|
|
48
|
-
/**
|
|
49
|
-
* The filesystem implementation to use.
|
|
50
|
-
* Defaults to node:fs/promises (works in Deno and Node.js).
|
|
51
|
-
*/
|
|
52
|
-
fs?: FileSystem;
|
|
53
14
|
/**
|
|
54
15
|
* The directory of the git repository.
|
|
55
16
|
* Defaults to the current working directory.
|
|
@@ -60,6 +21,43 @@ interface GitParserOptions {
|
|
|
60
21
|
* Used in help messages to indicate what kind of value this parser expects.
|
|
61
22
|
*/
|
|
62
23
|
metavar?: NonEmptyString;
|
|
24
|
+
/**
|
|
25
|
+
* Custom error messages for validation failures.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.9.0
|
|
28
|
+
*/
|
|
29
|
+
errors?: GitParserErrors;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Custom error messages for git value parsers.
|
|
33
|
+
*
|
|
34
|
+
* @since 0.9.0
|
|
35
|
+
*/
|
|
36
|
+
interface GitParserErrors {
|
|
37
|
+
/**
|
|
38
|
+
* Error message when the git reference (branch, tag, remote, commit) is not found.
|
|
39
|
+
*
|
|
40
|
+
* @param input The user-provided input that was not found.
|
|
41
|
+
* @param available List of available references (if applicable).
|
|
42
|
+
* @returns A custom error message.
|
|
43
|
+
*/
|
|
44
|
+
notFound?: (input: string, available?: readonly string[]) => Message;
|
|
45
|
+
/**
|
|
46
|
+
* Error message when listing git references fails.
|
|
47
|
+
* This typically occurs when the directory is not a valid git repository.
|
|
48
|
+
*
|
|
49
|
+
* @param dir The directory that was being accessed.
|
|
50
|
+
* @returns A custom error message.
|
|
51
|
+
*/
|
|
52
|
+
listFailed?: (dir: string) => Message;
|
|
53
|
+
/**
|
|
54
|
+
* Error message when the input format is invalid.
|
|
55
|
+
* Applies to parsers that validate format (e.g., commit SHA).
|
|
56
|
+
*
|
|
57
|
+
* @param input The user-provided input that has invalid format.
|
|
58
|
+
* @returns A custom error message.
|
|
59
|
+
*/
|
|
60
|
+
invalidFormat?: (input: string) => Message;
|
|
63
61
|
}
|
|
64
62
|
/**
|
|
65
63
|
* Git parsers factory interface.
|
|
@@ -67,11 +65,43 @@ interface GitParserOptions {
|
|
|
67
65
|
* @since 0.9.0
|
|
68
66
|
*/
|
|
69
67
|
interface GitParsers {
|
|
68
|
+
/**
|
|
69
|
+
* Creates a value parser that validates local branch names.
|
|
70
|
+
* @param options Configuration options for the parser.
|
|
71
|
+
* @returns A value parser that accepts existing branch names.
|
|
72
|
+
*/
|
|
70
73
|
branch(options?: GitParserOptions): ValueParser<"async", string>;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a value parser that validates remote branch names.
|
|
76
|
+
* @param remote The remote name to validate against.
|
|
77
|
+
* @param options Configuration options for the parser.
|
|
78
|
+
* @returns A value parser that accepts existing remote branch names.
|
|
79
|
+
*/
|
|
71
80
|
remoteBranch(remote: string, options?: GitParserOptions): ValueParser<"async", string>;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a value parser that validates tag names.
|
|
83
|
+
* @param options Configuration options for the parser.
|
|
84
|
+
* @returns A value parser that accepts existing tag names.
|
|
85
|
+
*/
|
|
72
86
|
tag(options?: GitParserOptions): ValueParser<"async", string>;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a value parser that validates remote names.
|
|
89
|
+
* @param options Configuration options for the parser.
|
|
90
|
+
* @returns A value parser that accepts existing remote names.
|
|
91
|
+
*/
|
|
73
92
|
remote(options?: GitParserOptions): ValueParser<"async", string>;
|
|
93
|
+
/**
|
|
94
|
+
* Creates a value parser that validates commit SHAs.
|
|
95
|
+
* @param options Configuration options for the parser.
|
|
96
|
+
* @returns A value parser that accepts existing commit SHAs.
|
|
97
|
+
*/
|
|
74
98
|
commit(options?: GitParserOptions): ValueParser<"async", string>;
|
|
99
|
+
/**
|
|
100
|
+
* Creates a value parser that validates any git reference.
|
|
101
|
+
* Accepts branch names, tag names, or commit SHAs.
|
|
102
|
+
* @param options Configuration options for the parser.
|
|
103
|
+
* @returns A value parser that accepts any git reference.
|
|
104
|
+
*/
|
|
75
105
|
ref(options?: GitParserOptions): ValueParser<"async", string>;
|
|
76
106
|
}
|
|
77
107
|
/**
|
|
@@ -116,100 +146,48 @@ declare function gitRemoteBranch(remote: string, options?: GitParserOptions): Va
|
|
|
116
146
|
/**
|
|
117
147
|
* Creates a value parser that validates tag names.
|
|
118
148
|
*
|
|
119
|
-
* This parser uses isomorphic-git to verify that the provided input
|
|
120
|
-
* matches an existing tag in the repository.
|
|
121
|
-
*
|
|
122
149
|
* @param options Configuration options for the parser.
|
|
123
150
|
* @returns A value parser that accepts existing tag names.
|
|
124
151
|
* @since 0.9.0
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ~~~~ typescript
|
|
128
|
-
* import { gitTag } from "@optique/git";
|
|
129
|
-
* import { option } from "@optique/core/primitives";
|
|
130
|
-
*
|
|
131
|
-
* const parser = option("-t", "--tag", gitTag());
|
|
132
|
-
* ~~~~
|
|
133
152
|
*/
|
|
134
153
|
declare function gitTag(options?: GitParserOptions): ValueParser<"async", string>;
|
|
135
154
|
/**
|
|
136
155
|
* Creates a value parser that validates remote names.
|
|
137
156
|
*
|
|
138
|
-
* This parser uses isomorphic-git to verify that the provided input
|
|
139
|
-
* matches an existing remote in the repository.
|
|
140
|
-
*
|
|
141
157
|
* @param options Configuration options for the parser.
|
|
142
158
|
* @returns A value parser that accepts existing remote names.
|
|
143
159
|
* @since 0.9.0
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ~~~~ typescript
|
|
147
|
-
* import { gitRemote } from "@optique/git";
|
|
148
|
-
* import { option } from "@optique/core/primitives";
|
|
149
|
-
*
|
|
150
|
-
* const parser = option("-r", "--remote", gitRemote());
|
|
151
|
-
* ~~~~
|
|
152
160
|
*/
|
|
153
161
|
declare function gitRemote(options?: GitParserOptions): ValueParser<"async", string>;
|
|
154
162
|
/**
|
|
155
163
|
* Creates a value parser that validates commit SHAs.
|
|
156
164
|
*
|
|
157
|
-
* This parser
|
|
158
|
-
*
|
|
165
|
+
* This parser resolves the provided commit reference to its full 40-character
|
|
166
|
+
* OID.
|
|
159
167
|
*
|
|
160
168
|
* @param options Configuration options for the parser.
|
|
161
|
-
* @returns A value parser that accepts
|
|
169
|
+
* @returns A value parser that accepts existing commit SHAs.
|
|
162
170
|
* @since 0.9.0
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ~~~~ typescript
|
|
166
|
-
* import { gitCommit } from "@optique/git";
|
|
167
|
-
* import { option } from "@optique/core/primitives";
|
|
168
|
-
*
|
|
169
|
-
* const parser = option("-c", "--commit", gitCommit());
|
|
170
|
-
* ~~~~
|
|
171
171
|
*/
|
|
172
172
|
declare function gitCommit(options?: GitParserOptions): ValueParser<"async", string>;
|
|
173
173
|
/**
|
|
174
|
-
* Creates a value parser that validates any git reference
|
|
175
|
-
* (branches, tags, or commits).
|
|
174
|
+
* Creates a value parser that validates any git reference.
|
|
176
175
|
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
176
|
+
* Accepts branch names, tag names, or commit SHAs and resolves them to the
|
|
177
|
+
* corresponding commit OID.
|
|
179
178
|
*
|
|
180
179
|
* @param options Configuration options for the parser.
|
|
181
|
-
* @returns A value parser that accepts
|
|
180
|
+
* @returns A value parser that accepts any git reference.
|
|
182
181
|
* @since 0.9.0
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ~~~~ typescript
|
|
186
|
-
* import { gitRef } from "@optique/git";
|
|
187
|
-
* import { option } from "@optique/core/primitives";
|
|
188
|
-
*
|
|
189
|
-
* const parser = option("--ref", gitRef());
|
|
190
|
-
* ~~~~
|
|
191
182
|
*/
|
|
192
183
|
declare function gitRef(options?: GitParserOptions): ValueParser<"async", string>;
|
|
193
184
|
/**
|
|
194
|
-
* Creates a
|
|
195
|
-
*
|
|
196
|
-
* This function returns an object with methods for creating individual git
|
|
197
|
-
* parsers that share the same configuration (filesystem and directory).
|
|
185
|
+
* Creates a set of git parsers with shared configuration.
|
|
198
186
|
*
|
|
199
|
-
* @param options Shared configuration
|
|
200
|
-
* @returns An object
|
|
187
|
+
* @param options Shared configuration for the parsers.
|
|
188
|
+
* @returns An object containing git parsers.
|
|
201
189
|
* @since 0.9.0
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* ~~~~ typescript
|
|
205
|
-
* import { createGitParsers } from "@optique/git";
|
|
206
|
-
*
|
|
207
|
-
* const git = createGitParsers({ dir: "/path/to/repo" });
|
|
208
|
-
*
|
|
209
|
-
* const branchParser = git.branch();
|
|
210
|
-
* const tagParser = git.tag();
|
|
211
|
-
* ~~~~
|
|
212
190
|
*/
|
|
213
191
|
declare function createGitParsers(options?: GitParserOptions): GitParsers;
|
|
214
192
|
//#endregion
|
|
215
|
-
export {
|
|
193
|
+
export { GitParserErrors, GitParserOptions, GitParsers, createGitParsers, expandOid, gitBranch, gitCommit, gitRef, gitRemote, gitRemoteBranch, gitTag, listBranches, listRemotes, listTags, readObject, resolveRef };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,55 +1,16 @@
|
|
|
1
|
+
import { Message } from "@optique/core/message";
|
|
1
2
|
import { NonEmptyString } from "@optique/core/nonempty";
|
|
2
3
|
import { expandOid, listBranches, listRemotes, listTags, readObject, resolveRef } from "isomorphic-git";
|
|
3
4
|
import { ValueParser } from "@optique/core/valueparser";
|
|
4
5
|
|
|
5
6
|
//#region src/index.d.ts
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
* Interface for FileSystem operations required by git parsers.
|
|
9
|
-
* This allows custom filesystem implementations for different environments.
|
|
10
|
-
*
|
|
11
|
-
* @since 0.9.0
|
|
12
|
-
*/
|
|
13
|
-
interface FileSystem {
|
|
14
|
-
readFile(path: string): Promise<Uint8Array | string>;
|
|
15
|
-
writeFile(path: string, data: Uint8Array | string): Promise<void>;
|
|
16
|
-
mkdir(path: string, options?: {
|
|
17
|
-
recursive?: boolean;
|
|
18
|
-
}): Promise<void>;
|
|
19
|
-
rmdir(path: string, options?: {
|
|
20
|
-
recursive?: boolean;
|
|
21
|
-
}): Promise<void>;
|
|
22
|
-
unlink(path: string): Promise<void>;
|
|
23
|
-
readdir(path: string): Promise<string[]>;
|
|
24
|
-
lstat(path: string): Promise<{
|
|
25
|
-
isSymbolicLink(): boolean;
|
|
26
|
-
isDirectory(): boolean;
|
|
27
|
-
isFile(): boolean;
|
|
28
|
-
}>;
|
|
29
|
-
stat(path: string): Promise<{
|
|
30
|
-
isSymbolicLink(): boolean;
|
|
31
|
-
isDirectory(): boolean;
|
|
32
|
-
isFile(): boolean;
|
|
33
|
-
}>;
|
|
34
|
-
readlink(path: string): Promise<string>;
|
|
35
|
-
symlink(target: string, path: string): Promise<void>;
|
|
36
|
-
chmod(path: string, mode: number): Promise<void>;
|
|
37
|
-
chown(path: string, uid: number, gid: number): Promise<void>;
|
|
38
|
-
rename(oldPath: string, newPath: string): Promise<void>;
|
|
39
|
-
copyFile(srcPath: string, destPath: string): Promise<void>;
|
|
40
|
-
exists(path: string): Promise<boolean>;
|
|
41
|
-
}
|
|
42
8
|
/**
|
|
43
9
|
* Options for creating git value parsers.
|
|
44
10
|
*
|
|
45
11
|
* @since 0.9.0
|
|
46
12
|
*/
|
|
47
13
|
interface GitParserOptions {
|
|
48
|
-
/**
|
|
49
|
-
* The filesystem implementation to use.
|
|
50
|
-
* Defaults to node:fs/promises (works in Deno and Node.js).
|
|
51
|
-
*/
|
|
52
|
-
fs?: FileSystem;
|
|
53
14
|
/**
|
|
54
15
|
* The directory of the git repository.
|
|
55
16
|
* Defaults to the current working directory.
|
|
@@ -60,6 +21,43 @@ interface GitParserOptions {
|
|
|
60
21
|
* Used in help messages to indicate what kind of value this parser expects.
|
|
61
22
|
*/
|
|
62
23
|
metavar?: NonEmptyString;
|
|
24
|
+
/**
|
|
25
|
+
* Custom error messages for validation failures.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.9.0
|
|
28
|
+
*/
|
|
29
|
+
errors?: GitParserErrors;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Custom error messages for git value parsers.
|
|
33
|
+
*
|
|
34
|
+
* @since 0.9.0
|
|
35
|
+
*/
|
|
36
|
+
interface GitParserErrors {
|
|
37
|
+
/**
|
|
38
|
+
* Error message when the git reference (branch, tag, remote, commit) is not found.
|
|
39
|
+
*
|
|
40
|
+
* @param input The user-provided input that was not found.
|
|
41
|
+
* @param available List of available references (if applicable).
|
|
42
|
+
* @returns A custom error message.
|
|
43
|
+
*/
|
|
44
|
+
notFound?: (input: string, available?: readonly string[]) => Message;
|
|
45
|
+
/**
|
|
46
|
+
* Error message when listing git references fails.
|
|
47
|
+
* This typically occurs when the directory is not a valid git repository.
|
|
48
|
+
*
|
|
49
|
+
* @param dir The directory that was being accessed.
|
|
50
|
+
* @returns A custom error message.
|
|
51
|
+
*/
|
|
52
|
+
listFailed?: (dir: string) => Message;
|
|
53
|
+
/**
|
|
54
|
+
* Error message when the input format is invalid.
|
|
55
|
+
* Applies to parsers that validate format (e.g., commit SHA).
|
|
56
|
+
*
|
|
57
|
+
* @param input The user-provided input that has invalid format.
|
|
58
|
+
* @returns A custom error message.
|
|
59
|
+
*/
|
|
60
|
+
invalidFormat?: (input: string) => Message;
|
|
63
61
|
}
|
|
64
62
|
/**
|
|
65
63
|
* Git parsers factory interface.
|
|
@@ -67,11 +65,43 @@ interface GitParserOptions {
|
|
|
67
65
|
* @since 0.9.0
|
|
68
66
|
*/
|
|
69
67
|
interface GitParsers {
|
|
68
|
+
/**
|
|
69
|
+
* Creates a value parser that validates local branch names.
|
|
70
|
+
* @param options Configuration options for the parser.
|
|
71
|
+
* @returns A value parser that accepts existing branch names.
|
|
72
|
+
*/
|
|
70
73
|
branch(options?: GitParserOptions): ValueParser<"async", string>;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a value parser that validates remote branch names.
|
|
76
|
+
* @param remote The remote name to validate against.
|
|
77
|
+
* @param options Configuration options for the parser.
|
|
78
|
+
* @returns A value parser that accepts existing remote branch names.
|
|
79
|
+
*/
|
|
71
80
|
remoteBranch(remote: string, options?: GitParserOptions): ValueParser<"async", string>;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a value parser that validates tag names.
|
|
83
|
+
* @param options Configuration options for the parser.
|
|
84
|
+
* @returns A value parser that accepts existing tag names.
|
|
85
|
+
*/
|
|
72
86
|
tag(options?: GitParserOptions): ValueParser<"async", string>;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a value parser that validates remote names.
|
|
89
|
+
* @param options Configuration options for the parser.
|
|
90
|
+
* @returns A value parser that accepts existing remote names.
|
|
91
|
+
*/
|
|
73
92
|
remote(options?: GitParserOptions): ValueParser<"async", string>;
|
|
93
|
+
/**
|
|
94
|
+
* Creates a value parser that validates commit SHAs.
|
|
95
|
+
* @param options Configuration options for the parser.
|
|
96
|
+
* @returns A value parser that accepts existing commit SHAs.
|
|
97
|
+
*/
|
|
74
98
|
commit(options?: GitParserOptions): ValueParser<"async", string>;
|
|
99
|
+
/**
|
|
100
|
+
* Creates a value parser that validates any git reference.
|
|
101
|
+
* Accepts branch names, tag names, or commit SHAs.
|
|
102
|
+
* @param options Configuration options for the parser.
|
|
103
|
+
* @returns A value parser that accepts any git reference.
|
|
104
|
+
*/
|
|
75
105
|
ref(options?: GitParserOptions): ValueParser<"async", string>;
|
|
76
106
|
}
|
|
77
107
|
/**
|
|
@@ -116,100 +146,48 @@ declare function gitRemoteBranch(remote: string, options?: GitParserOptions): Va
|
|
|
116
146
|
/**
|
|
117
147
|
* Creates a value parser that validates tag names.
|
|
118
148
|
*
|
|
119
|
-
* This parser uses isomorphic-git to verify that the provided input
|
|
120
|
-
* matches an existing tag in the repository.
|
|
121
|
-
*
|
|
122
149
|
* @param options Configuration options for the parser.
|
|
123
150
|
* @returns A value parser that accepts existing tag names.
|
|
124
151
|
* @since 0.9.0
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ~~~~ typescript
|
|
128
|
-
* import { gitTag } from "@optique/git";
|
|
129
|
-
* import { option } from "@optique/core/primitives";
|
|
130
|
-
*
|
|
131
|
-
* const parser = option("-t", "--tag", gitTag());
|
|
132
|
-
* ~~~~
|
|
133
152
|
*/
|
|
134
153
|
declare function gitTag(options?: GitParserOptions): ValueParser<"async", string>;
|
|
135
154
|
/**
|
|
136
155
|
* Creates a value parser that validates remote names.
|
|
137
156
|
*
|
|
138
|
-
* This parser uses isomorphic-git to verify that the provided input
|
|
139
|
-
* matches an existing remote in the repository.
|
|
140
|
-
*
|
|
141
157
|
* @param options Configuration options for the parser.
|
|
142
158
|
* @returns A value parser that accepts existing remote names.
|
|
143
159
|
* @since 0.9.0
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ~~~~ typescript
|
|
147
|
-
* import { gitRemote } from "@optique/git";
|
|
148
|
-
* import { option } from "@optique/core/primitives";
|
|
149
|
-
*
|
|
150
|
-
* const parser = option("-r", "--remote", gitRemote());
|
|
151
|
-
* ~~~~
|
|
152
160
|
*/
|
|
153
161
|
declare function gitRemote(options?: GitParserOptions): ValueParser<"async", string>;
|
|
154
162
|
/**
|
|
155
163
|
* Creates a value parser that validates commit SHAs.
|
|
156
164
|
*
|
|
157
|
-
* This parser
|
|
158
|
-
*
|
|
165
|
+
* This parser resolves the provided commit reference to its full 40-character
|
|
166
|
+
* OID.
|
|
159
167
|
*
|
|
160
168
|
* @param options Configuration options for the parser.
|
|
161
|
-
* @returns A value parser that accepts
|
|
169
|
+
* @returns A value parser that accepts existing commit SHAs.
|
|
162
170
|
* @since 0.9.0
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ~~~~ typescript
|
|
166
|
-
* import { gitCommit } from "@optique/git";
|
|
167
|
-
* import { option } from "@optique/core/primitives";
|
|
168
|
-
*
|
|
169
|
-
* const parser = option("-c", "--commit", gitCommit());
|
|
170
|
-
* ~~~~
|
|
171
171
|
*/
|
|
172
172
|
declare function gitCommit(options?: GitParserOptions): ValueParser<"async", string>;
|
|
173
173
|
/**
|
|
174
|
-
* Creates a value parser that validates any git reference
|
|
175
|
-
* (branches, tags, or commits).
|
|
174
|
+
* Creates a value parser that validates any git reference.
|
|
176
175
|
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
176
|
+
* Accepts branch names, tag names, or commit SHAs and resolves them to the
|
|
177
|
+
* corresponding commit OID.
|
|
179
178
|
*
|
|
180
179
|
* @param options Configuration options for the parser.
|
|
181
|
-
* @returns A value parser that accepts
|
|
180
|
+
* @returns A value parser that accepts any git reference.
|
|
182
181
|
* @since 0.9.0
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ~~~~ typescript
|
|
186
|
-
* import { gitRef } from "@optique/git";
|
|
187
|
-
* import { option } from "@optique/core/primitives";
|
|
188
|
-
*
|
|
189
|
-
* const parser = option("--ref", gitRef());
|
|
190
|
-
* ~~~~
|
|
191
182
|
*/
|
|
192
183
|
declare function gitRef(options?: GitParserOptions): ValueParser<"async", string>;
|
|
193
184
|
/**
|
|
194
|
-
* Creates a
|
|
195
|
-
*
|
|
196
|
-
* This function returns an object with methods for creating individual git
|
|
197
|
-
* parsers that share the same configuration (filesystem and directory).
|
|
185
|
+
* Creates a set of git parsers with shared configuration.
|
|
198
186
|
*
|
|
199
|
-
* @param options Shared configuration
|
|
200
|
-
* @returns An object
|
|
187
|
+
* @param options Shared configuration for the parsers.
|
|
188
|
+
* @returns An object containing git parsers.
|
|
201
189
|
* @since 0.9.0
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* ~~~~ typescript
|
|
205
|
-
* import { createGitParsers } from "@optique/git";
|
|
206
|
-
*
|
|
207
|
-
* const git = createGitParsers({ dir: "/path/to/repo" });
|
|
208
|
-
*
|
|
209
|
-
* const branchParser = git.branch();
|
|
210
|
-
* const tagParser = git.tag();
|
|
211
|
-
* ~~~~
|
|
212
190
|
*/
|
|
213
191
|
declare function createGitParsers(options?: GitParserOptions): GitParsers;
|
|
214
192
|
//#endregion
|
|
215
|
-
export {
|
|
193
|
+
export { GitParserErrors, GitParserOptions, GitParsers, createGitParsers, expandOid, gitBranch, gitCommit, gitRef, gitRemote, gitRemoteBranch, gitTag, listBranches, listRemotes, listTags, readObject, resolveRef };
|