aboutsummaryrefslogtreecommitdiff
path: root/node_modules/simple-git/src/lib/utils
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-02-12 10:33:06 +0100
committerMinteck <contact@minteck.org>2022-02-12 10:33:06 +0100
commit01160246e4a0c0052181c72a53737e356ea7d02d (patch)
treec6f8ea675f9147d4c06ef503697fb35d58493991 /node_modules/simple-git/src/lib/utils
parentaf898a152a14e31bdbcbbedb952ad333697553ef (diff)
downloadtwilight-01160246e4a0c0052181c72a53737e356ea7d02d.tar.gz
twilight-01160246e4a0c0052181c72a53737e356ea7d02d.tar.bz2
twilight-01160246e4a0c0052181c72a53737e356ea7d02d.zip
First commit
Diffstat (limited to 'node_modules/simple-git/src/lib/utils')
-rw-r--r--node_modules/simple-git/src/lib/utils/argument-filters.d.ts16
-rw-r--r--node_modules/simple-git/src/lib/utils/exit-codes.d.ts9
-rw-r--r--node_modules/simple-git/src/lib/utils/git-output-streams.d.ts8
-rw-r--r--node_modules/simple-git/src/lib/utils/index.d.ts8
-rw-r--r--node_modules/simple-git/src/lib/utils/line-parser.d.ts15
-rw-r--r--node_modules/simple-git/src/lib/utils/simple-git-options.d.ts2
-rw-r--r--node_modules/simple-git/src/lib/utils/task-options.d.ts13
-rw-r--r--node_modules/simple-git/src/lib/utils/task-parser.d.ts5
-rw-r--r--node_modules/simple-git/src/lib/utils/util.d.ts45
9 files changed, 121 insertions, 0 deletions
diff --git a/node_modules/simple-git/src/lib/utils/argument-filters.d.ts b/node_modules/simple-git/src/lib/utils/argument-filters.d.ts
new file mode 100644
index 0000000..6be6925
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/argument-filters.d.ts
@@ -0,0 +1,16 @@
+import { Options, Primitives } from '../types';
+export interface ArgumentFilterPredicate<T> {
+ (input: any): input is T;
+}
+export declare function filterType<T, K>(input: K, filter: ArgumentFilterPredicate<T>): K extends T ? T : undefined;
+export declare function filterType<T, K>(input: K, filter: ArgumentFilterPredicate<T>, def: T): T;
+export declare const filterArray: ArgumentFilterPredicate<Array<any>>;
+export declare function filterPrimitives(input: unknown, omit?: Array<'boolean' | 'string' | 'number'>): input is Primitives;
+export declare const filterString: ArgumentFilterPredicate<string>;
+export declare const filterStringArray: ArgumentFilterPredicate<string[]>;
+export declare const filterStringOrStringArray: ArgumentFilterPredicate<string | string[]>;
+export declare function filterPlainObject<T extends Options>(input: T | unknown): input is T;
+export declare function filterFunction(input: unknown): input is Function;
+export declare const filterHasLength: ArgumentFilterPredicate<{
+ length: number;
+}>;
diff --git a/node_modules/simple-git/src/lib/utils/exit-codes.d.ts b/node_modules/simple-git/src/lib/utils/exit-codes.d.ts
new file mode 100644
index 0000000..1c389c7
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/exit-codes.d.ts
@@ -0,0 +1,9 @@
+/**
+ * Known process exit codes used by the task parsers to determine whether an error
+ * was one they can automatically handle
+ */
+export declare enum ExitCodes {
+ SUCCESS = 0,
+ ERROR = 1,
+ UNCLEAN = 128
+}
diff --git a/node_modules/simple-git/src/lib/utils/git-output-streams.d.ts b/node_modules/simple-git/src/lib/utils/git-output-streams.d.ts
new file mode 100644
index 0000000..72db466
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/git-output-streams.d.ts
@@ -0,0 +1,8 @@
+/// <reference types="node" />
+import { TaskResponseFormat } from '../types';
+export declare class GitOutputStreams<T extends TaskResponseFormat = Buffer> {
+ readonly stdOut: T;
+ readonly stdErr: T;
+ constructor(stdOut: T, stdErr: T);
+ asStrings(): GitOutputStreams<string>;
+}
diff --git a/node_modules/simple-git/src/lib/utils/index.d.ts b/node_modules/simple-git/src/lib/utils/index.d.ts
new file mode 100644
index 0000000..04cb604
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/index.d.ts
@@ -0,0 +1,8 @@
+export * from './argument-filters';
+export * from './exit-codes';
+export * from './git-output-streams';
+export * from './line-parser';
+export * from './simple-git-options';
+export * from './task-options';
+export * from './task-parser';
+export * from './util';
diff --git a/node_modules/simple-git/src/lib/utils/line-parser.d.ts b/node_modules/simple-git/src/lib/utils/line-parser.d.ts
new file mode 100644
index 0000000..c50560a
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/line-parser.d.ts
@@ -0,0 +1,15 @@
+export declare class LineParser<T> {
+ protected matches: string[];
+ private _regExp;
+ constructor(regExp: RegExp | RegExp[], useMatches?: (target: T, match: string[]) => boolean | void);
+ parse: (line: (offset: number) => (string | undefined), target: T) => boolean;
+ protected useMatches(target: T, match: string[]): boolean | void;
+ protected resetMatches(): void;
+ protected prepareMatches(): string[];
+ protected addMatch(reg: RegExp, index: number, line?: string): boolean;
+ protected pushMatch(_index: number, matched: string[]): void;
+}
+export declare class RemoteLineParser<T> extends LineParser<T> {
+ protected addMatch(reg: RegExp, index: number, line?: string): boolean;
+ protected pushMatch(index: number, matched: string[]): void;
+}
diff --git a/node_modules/simple-git/src/lib/utils/simple-git-options.d.ts b/node_modules/simple-git/src/lib/utils/simple-git-options.d.ts
new file mode 100644
index 0000000..552d68d
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/simple-git-options.d.ts
@@ -0,0 +1,2 @@
+import { SimpleGitOptions } from '../types';
+export declare function createInstanceConfig(...options: Array<Partial<SimpleGitOptions> | undefined>): SimpleGitOptions;
diff --git a/node_modules/simple-git/src/lib/utils/task-options.d.ts b/node_modules/simple-git/src/lib/utils/task-options.d.ts
new file mode 100644
index 0000000..23d3705
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/task-options.d.ts
@@ -0,0 +1,13 @@
+import { Maybe, Options } from '../types';
+export declare function appendTaskOptions<T extends Options = Options>(options: Maybe<T>, commands?: string[]): string[];
+export declare function getTrailingOptions(args: IArguments, initialPrimitive?: number, objectOnly?: boolean): string[];
+/**
+ * Given any number of arguments, returns the trailing options argument, ignoring a trailing function argument
+ * if there is one. When not found, the return value is null.
+ */
+export declare function trailingOptionsArgument(args: IArguments): Maybe<Options>;
+/**
+ * Returns either the source argument when it is a `Function`, or the default
+ * `NOOP` function constant
+ */
+export declare function trailingFunctionArgument(args: unknown[] | IArguments | unknown, includeNoop?: boolean): Maybe<(...args: any[]) => unknown>;
diff --git a/node_modules/simple-git/src/lib/utils/task-parser.d.ts b/node_modules/simple-git/src/lib/utils/task-parser.d.ts
new file mode 100644
index 0000000..5734495
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/task-parser.d.ts
@@ -0,0 +1,5 @@
+import { TaskParser, TaskResponseFormat } from '../types';
+import { GitOutputStreams } from './git-output-streams';
+import { LineParser } from './line-parser';
+export declare function callTaskParser<INPUT extends TaskResponseFormat, RESPONSE>(parser: TaskParser<INPUT, RESPONSE>, streams: GitOutputStreams<INPUT>): RESPONSE;
+export declare function parseStringResponse<T>(result: T, parsers: LineParser<T>[], ...texts: string[]): T;
diff --git a/node_modules/simple-git/src/lib/utils/util.d.ts b/node_modules/simple-git/src/lib/utils/util.d.ts
new file mode 100644
index 0000000..5f0b543
--- /dev/null
+++ b/node_modules/simple-git/src/lib/utils/util.d.ts
@@ -0,0 +1,45 @@
+/// <reference types="node" />
+import { Maybe } from '../types';
+export declare const NULL = "\0";
+export declare const NOOP: (...args: any[]) => void;
+/**
+ * Returns either the source argument when it is a `Function`, or the default
+ * `NOOP` function constant
+ */
+export declare function asFunction<T extends () => any>(source: T | any): T;
+/**
+ * Determines whether the supplied argument is both a function, and is not
+ * the `NOOP` function.
+ */
+export declare function isUserFunction<T extends Function>(source: T | any): source is T;
+export declare function splitOn(input: string, char: string): [string, string];
+export declare function first<T extends any[]>(input: T, offset?: number): Maybe<T[number]>;
+export declare function first<T extends IArguments>(input: T, offset?: number): Maybe<unknown>;
+export declare function last<T extends any[]>(input: T, offset?: number): Maybe<T[number]>;
+export declare function last<T extends IArguments>(input: T, offset?: number): Maybe<unknown>;
+export declare function last<T>(input: T, offset?: number): Maybe<unknown>;
+export declare function toLinesWithContent(input?: string, trimmed?: boolean, separator?: string): string[];
+declare type LineWithContentCallback<T = void> = (line: string) => T;
+export declare function forEachLineWithContent<T>(input: string, callback: LineWithContentCallback<T>): T[];
+export declare function folderExists(path: string): boolean;
+/**
+ * Adds `item` into the `target` `Array` or `Set` when it is not already present and returns the `item`.
+ */
+export declare function append<T>(target: T[] | Set<T>, item: T): typeof item;
+/**
+ * Adds `item` into the `target` `Array` when it is not already present and returns the `target`.
+ */
+export declare function including<T>(target: T[], item: T): typeof target;
+export declare function remove<T>(target: Set<T> | T[], item: T): T;
+export declare const objectToString: (input: any) => string;
+export declare function asArray<T>(source: T | T[]): T[];
+export declare function asStringArray<T>(source: T | T[]): string[];
+export declare function asNumber(source: string | null | undefined, onNaN?: number): number;
+export declare function prefixedArray<T>(input: T[], prefix: T): T[];
+export declare function bufferToString(input: Buffer | Buffer[]): string;
+/**
+ * Get a new object from a source object with only the listed properties.
+ */
+export declare function pick(source: Record<string, any>, properties: string[]): any;
+export declare function delay(duration?: number): Promise<void>;
+export {};