-
Notifications
You must be signed in to change notification settings - Fork 0
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
431769d
commit 45cd775
Showing
1 changed file
with
32 additions
and
3 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 |
---|---|---|
@@ -1,7 +1,36 @@ | ||
import {Command} from '@oclif/core' | ||
import {Args, Command, Flags, Interfaces} from '@oclif/core' | ||
|
||
type Result = { | ||
args: Interfaces.InferredArgs<typeof CoreV2.args> | ||
flags: Interfaces.InferredFlags<typeof CoreV2.flags> | ||
} | ||
|
||
export default class CoreV2 extends Command { | ||
public async run(): Promise<void> { | ||
this.log(`hello I am an @oclif/core@v2 plugin from ${this.config.root}!`) | ||
static flags = { | ||
optionalString: Flags.string(), | ||
defaultString: Flags.string({ | ||
default: 'simple string default', | ||
}), | ||
defaultFnString: Flags.string({ | ||
default: async () => Promise.resolve('async fn default'), | ||
}), | ||
} | ||
|
||
static args = { | ||
optionalArg: Args.string(), | ||
defaultArg: Args.string({ | ||
default: 'simple string default', | ||
}), | ||
defaultFnArg: Args.string({ | ||
default: async () => Promise.resolve('async fn default'), | ||
}), | ||
} | ||
|
||
static enableJsonFlag = true | ||
|
||
async run(): Promise<Result> { | ||
const {args, flags} = await this.parse(CoreV2) | ||
this.log(`hello I am a CJS plugin from ${this.config.root}!`) | ||
return {args, flags} | ||
} | ||
} |