-
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
1 parent
a8ded5b
commit 26c0424
Showing
10 changed files
with
55 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,5 @@ | |
/tmp | ||
/node_modules | ||
oclif.manifest.json | ||
|
||
|
||
|
||
yarn.lock | ||
pnpm-lock.yaml | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 was deleted.
Oops, something went wrong.
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,33 @@ | ||
import {Args, Command, Flags} from '@oclif/core' | ||
|
||
export default class Install extends Command { | ||
static args = { | ||
package_name: Args.string({ | ||
description: 'package to install', | ||
required: true, | ||
}), | ||
} | ||
|
||
static description = 'Install a package' | ||
|
||
static examples = [ | ||
'<%= config.bin %> <%= command.id %> package-name', | ||
] | ||
|
||
static flags = { | ||
force: Flags.boolean({char: 'f'}), | ||
name: Flags.string({char: 'n', description: 'name to print'}), | ||
} | ||
|
||
static aliases = ['i'] | ||
|
||
public async run(): Promise<void> { | ||
const {args, flags} = await this.parse(Install) | ||
|
||
const name = flags.name ?? 'world' | ||
this.log(`hello ${name} from /Users/qin/Projects/cli/src/commands/install.ts!`) | ||
if (args.package_name && flags.force) { | ||
this.log(`you input --force and --package_name: ${args.package_name}`) | ||
} | ||
} | ||
} |
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 +1,2 @@ | ||
export {run} from '@oclif/core' | ||
console.log("Hi!"); |
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 {runCommand} from '@oclif/test' | ||
import {expect} from 'chai' | ||
|
||
describe('install', () => { | ||
it('runs install cmd', async () => { | ||
const {stdout} = await runCommand('install') | ||
expect(stdout).to.contain('hello world') | ||
}) | ||
|
||
it('runs install --name oclif', async () => { | ||
const {stdout} = await runCommand('install --name oclif') | ||
expect(stdout).to.contain('hello oclif') | ||
}) | ||
}) |
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
Large diffs are not rendered by default.
Oops, something went wrong.