-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
385 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { getBaseFolder } from '../fileHandler' | ||
import inquirer from 'inquirer' | ||
|
||
export abstract class Command { | ||
protected readonly baseFolder: string | ||
|
||
constructor () { | ||
this.baseFolder = getBaseFolder() | ||
} | ||
|
||
abstract beforeExecute (): Promise<any> | ||
abstract execute (): Promise<void> | ||
async askForConfirmation (): Promise<boolean> { | ||
const answer = await inquirer.prompt([ | ||
{ | ||
type: 'confirm', | ||
name: 'confirmation', | ||
message: 'Are you sure you want to perform this operation?', | ||
default: false | ||
} | ||
]) | ||
|
||
return answer.confirmation | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { type Command } from './Command' | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class | ||
export class CommandInvoker { | ||
static executeCommands (command: Command): any { | ||
return command.execute() | ||
} | ||
} |
Oops, something went wrong.