-
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.
[refactor] Changed file structure and added factories
- Loading branch information
Showing
18 changed files
with
168 additions
and
429 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
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,35 @@ | ||
import { CommandTypes } from '../const' | ||
import { | ||
type Command, | ||
LsCommand, | ||
SyncCommand, | ||
UpdateAllCommand, | ||
CompareCommand, | ||
UpdateCommand, | ||
RevertCommand, | ||
RestoreCommand | ||
} from '.' | ||
|
||
export class CommandFactory { | ||
createCommand (commandType: number): Command | null { | ||
switch (commandType) { | ||
case CommandTypes.LS: | ||
return new LsCommand() | ||
case CommandTypes.SYNC: | ||
return new SyncCommand() | ||
case CommandTypes.COMPARE: | ||
return new CompareCommand() | ||
case CommandTypes.UPDATE: | ||
return new UpdateCommand() | ||
case CommandTypes.UPDATE_ALL: | ||
return new UpdateAllCommand() | ||
case CommandTypes.REVERT: | ||
return new RevertCommand() | ||
case CommandTypes.RESTORE_ENV: | ||
return new RestoreCommand() | ||
|
||
default: | ||
return null | ||
} | ||
} | ||
} |
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
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
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
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
export * from './commandTypes/LsCommand' | ||
export * from './commandTypes/SyncCommand' | ||
export * from './commandTypes/UpdateAllCommand' | ||
export * from './commandTypes/UpdateCommand' | ||
export * from './commandTypes/CompareCommand' | ||
export * from './commandTypes/RevertCommand' | ||
export * from './commandTypes/RestoreCommand' | ||
export * from './CommandInvoker' | ||
export * from './Command' | ||
export * from './commandTypes/lsCommand' | ||
export * from './commandTypes/syncCommand' | ||
export * from './commandTypes/updateAllCommand' | ||
export * from './commandTypes/updateCommand' | ||
export * from './commandTypes/compareCommand' | ||
export * from './commandTypes/revertCommand' | ||
export * from './commandTypes/restoreCommand' | ||
export * from './commandInvoker' | ||
export * from './command' | ||
export * from './commandFactory' |
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,9 @@ | ||
export enum CommandTypes { | ||
LS = 1, | ||
SYNC = 2, | ||
UPDATE_ALL = 3, | ||
COMPARE = 4, | ||
UPDATE = 5, | ||
REVERT = 6, | ||
RESTORE_ENV = 7 | ||
} |
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.