Skip to content
Discussion options

You must be logged in to vote

Yup. The docs are missing on same. So lemme try to explain it here.

Following command creates a new command for you

node ace make:command <NAME>

The empty command class has 3 properties

import { BaseCommand } from '@adonisjs/ace'

export default class YourCommandName extends BaseCommand {
	public static commandName = 'commandName'
	public static description = 'Description'

	public async handle() {
	}
}

The commandName and description is for the help screen. The handle method is called when your command is executed.

You can accept flags using the @flags decorator. Here's an example: https://github.com/adonisjs/core/blob/develop/commands/ListRoutes.ts#L22-L23

You can accept arguments using…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bstsnail
Comment options

Answer selected by thetutlage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants