-
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.
chore: Add remove project config command
- Loading branch information
1 parent
f5dc7ad
commit 56e9171
Showing
9 changed files
with
78 additions
and
62 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
import { Command } from 'commander' | ||
import { projectConfig } from '../../../config/project.config' | ||
|
||
export function generateProjectConfigCommand() { | ||
return new Command() | ||
.name('generate') | ||
.alias('create') | ||
.summary('Generate a new deafult project config') | ||
.action(() => { | ||
projectConfig.save(projectConfig.default()) | ||
}) | ||
} |
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,14 @@ | ||
import { Command } from 'commander' | ||
import { generateProjectConfigCommand } from './generate' | ||
import { removeProjectCommand } from './remove' | ||
import { viewProjectConfigCommand } from './view' | ||
|
||
export function projectConfigCommand() { | ||
return new Command() | ||
.name('config') | ||
.alias('settings') | ||
.summary('Manages the current project configuration') | ||
.addCommand(viewProjectConfigCommand()) | ||
.addCommand(generateProjectConfigCommand()) | ||
.addCommand(removeProjectCommand()) | ||
} |
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,19 @@ | ||
import { confirm } from '@inquirer/prompts' | ||
import { Command } from 'commander' | ||
import { projectConfig } from '../../../config/project.config' | ||
|
||
export function removeProjectCommand() { | ||
return new Command() | ||
.name('remove') | ||
.aliases(['destroy', 'delete']) | ||
.summary('Removes a project from DEMS') | ||
.argument('<project>', 'Project name to be removed') | ||
.action(async (project) => { | ||
const deletionConfirmation = await confirm({ | ||
message: `Do you want to remove project ${project}?`, | ||
}) | ||
if (deletionConfirmation) { | ||
projectConfig.remove(project) | ||
} | ||
}) | ||
} |
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,12 @@ | ||
import { Command } from 'commander' | ||
import { projectConfig } from '../../../config/project.config' | ||
|
||
export function viewProjectConfigCommand() { | ||
return new Command() | ||
.name('view') | ||
.aliases(['get', 'show']) | ||
.summary('Shows the current project config') | ||
.action(() => { | ||
console.log(projectConfig.get()) | ||
}) | ||
} |
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 was deleted.
Oops, something went wrong.
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