@adonisjs/ace
Advanced tools
Comparing version 11.0.7 to 11.1.0
@@ -21,2 +21,11 @@ import { ParsedOptions } from 'getopts'; | ||
/** | ||
* Is the current command the main command executed from the | ||
* CLI | ||
*/ | ||
get isMain(): boolean; | ||
/** | ||
* Terminal is interactive | ||
*/ | ||
get isInteractive(): boolean; | ||
/** | ||
* Command arguments | ||
@@ -23,0 +32,0 @@ */ |
@@ -49,2 +49,15 @@ "use strict"; | ||
/** | ||
* Is the current command the main command executed from the | ||
* CLI | ||
*/ | ||
get isMain() { | ||
return this.kernel.isMain(this); | ||
} | ||
/** | ||
* Terminal is interactive | ||
*/ | ||
get isInteractive() { | ||
return this.kernel.isInteractive; | ||
} | ||
/** | ||
* Boots the command by defining required static properties | ||
@@ -51,0 +64,0 @@ */ |
@@ -105,2 +105,14 @@ import * as ui from '@poppinss/cliui'; | ||
kernel: KernelContract; | ||
/** | ||
* The flag is set to true, when the command is executed as the main command | ||
* from the terminal. | ||
* | ||
* However, set to false when command is executed programmatically. | ||
*/ | ||
readonly isMain: boolean; | ||
/** | ||
* The flag is set to true, when the commandline is in interactive mode. | ||
* Can be disabled manually via the kernel | ||
*/ | ||
readonly isInteractive: boolean; | ||
onExit(callback: () => Promise<void> | void): this; | ||
@@ -261,3 +273,3 @@ exit(): Promise<void>; | ||
*/ | ||
handle(argv: string[]): Promise<any>; | ||
handle(args: string[]): Promise<any>; | ||
/** | ||
@@ -272,2 +284,15 @@ * Execute a command by its name and args | ||
/** | ||
* Find if a command is the main command. Main commands are executed | ||
* directly from the terminal | ||
*/ | ||
isMain(command: CommandContract): boolean; | ||
/** | ||
* Find if CLI process is interactive. | ||
*/ | ||
isInteractive: boolean; | ||
/** | ||
* Toggle isInteractive state | ||
*/ | ||
interactive(state: boolean): this; | ||
/** | ||
* Trigger exit flow | ||
@@ -274,0 +299,0 @@ */ |
@@ -33,2 +33,7 @@ import { ApplicationContract } from '@ioc:Adonis/Core/Application'; | ||
/** | ||
* Find if CLI process is interactive. This flag can be | ||
* toggled programmatically | ||
*/ | ||
isInteractive: boolean; | ||
/** | ||
* The default command that will be invoked when no command is | ||
@@ -138,2 +143,11 @@ * defined | ||
/** | ||
* Find if a command is the main command. Main commands are executed | ||
* directly from the terminal. | ||
*/ | ||
isMain(command: CommandContract): boolean; | ||
/** | ||
* Toggle interactive state | ||
*/ | ||
interactive(state: boolean): this; | ||
/** | ||
* Execute a command as a sub-command. Do not call "handle" and | ||
@@ -140,0 +154,0 @@ * always use this method to invoke command programatically |
@@ -48,2 +48,7 @@ "use strict"; | ||
/** | ||
* Find if CLI process is interactive. This flag can be | ||
* toggled programmatically | ||
*/ | ||
this.isInteractive = cliui_1.isInteractive; | ||
/** | ||
* The default command that will be invoked when no command is | ||
@@ -394,3 +399,3 @@ * defined | ||
*/ | ||
const commandInstance = this.application.container.make(this.defaultCommand, [ | ||
const commandInstance = await this.application.container.makeAsync(this.defaultCommand, [ | ||
this.application, | ||
@@ -413,2 +418,16 @@ this, | ||
/** | ||
* Find if a command is the main command. Main commands are executed | ||
* directly from the terminal. | ||
*/ | ||
isMain(command) { | ||
return !!this.entryCommand && this.entryCommand === command; | ||
} | ||
/** | ||
* Toggle interactive state | ||
*/ | ||
interactive(state) { | ||
this.isInteractive = state; | ||
return this; | ||
} | ||
/** | ||
* Execute a command as a sub-command. Do not call "handle" and | ||
@@ -420,4 +439,3 @@ * always use this method to invoke command programatically | ||
/** | ||
* Command not found. So execute global flags handlers and | ||
* raise an exception | ||
* Command not found. | ||
*/ | ||
@@ -430,3 +448,6 @@ if (!command) { | ||
*/ | ||
const commandInstance = this.application.container.make(command, [this.application, this]); | ||
const commandInstance = await this.application.container.makeAsync(command, [ | ||
this.application, | ||
this, | ||
]); | ||
/** | ||
@@ -433,0 +454,0 @@ * Process args and flags for the command |
{ | ||
"name": "@adonisjs/ace", | ||
"version": "11.0.7", | ||
"version": "11.1.0", | ||
"description": "Commandline apps framework used by AdonisJs", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
123136
3542