fix: code housekeeping

This commit is contained in:
Cheng Liu 2024-02-21 17:36:16 -08:00
parent f3ed8fbcf7
commit 262bdcd2dc
No known key found for this signature in database
GPG key ID: EEC8452F7DB85CD6
3 changed files with 12 additions and 6 deletions

View file

@ -54,7 +54,7 @@ export class SparoCommandLine {
// proxy to gitService
if (!this._supportedCommand(userInputCmdName)) {
const gitService: GitService = await getFromContainerAsync(GitService);
const args: string[] = process.argv.slice(2);
const args: string[] = argv.stripSparoArgs(process.argv.slice(2));
gitService.executeGitCommand({
args
});

View file

@ -66,11 +66,6 @@ export class CheckoutCommand implements ICommand<ICheckoutCommandOptions> {
args: ArgumentsCamelCase<ICheckoutCommandOptions>,
terminalService: TerminalService
): Promise<void> => {
console.log(JSON.stringify(args, null, 2));
const a: number = 1;
if (a > 0) {
process.exit(1);
}
const { _gitService: gitService, _localState: localState } = this;
const { b, B, branch, startPoint } = args;

View file

@ -31,6 +31,17 @@ export class ArgvService {
return String(this._parsed._[0] || '');
}
public stripSparoArgs(args: string[]): string[] {
const newArgs: string[] = [];
for (const arg of args) {
if (['--debug', '--verbose'].includes(arg)) {
continue;
}
newArgs.push(arg);
}
return newArgs;
}
private _terminalMiddleware: MiddlewareFunction<{
debug: boolean | undefined;
verbose: boolean | undefined;