velvet_cli

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

velvet cli

Velvet Cli #
This is a command line interface for the Velvet Framework. It allows you to speed up your development process by generating boilerplate code for your project and executing commands to manage your project.
Commands #
Overview #



Command
Description




make:route
Generates a new route and a new page


list
Returns a list of all the routes in your project


update:cli
Updates the Velvet CLI to the latest version


update:framework
Updates the Velvet Framework to the latest version



make route #
flutter run velvet_cli make:route
copied to clipboard
Generates a new route and a new page in your project.
Also adds mandatory part and import in the routes.dart file.
list #
flutter run velvet_cli list
copied to clipboard
Returns a list of all the routes in your project.
update cli #
flutter run velvet_cli update:cli
copied to clipboard
Updates the Velvet CLI to the latest version.
update framework #
flutter run velvet_cli update:framework
copied to clipboard
Updates the Velvet Framework to the latest version.
Custom Commands #
You can also create custom commands for your project.

Create a bin folder in the root of your project.
Create the main.dart file in the bin folder with following code:

import 'package:velvet_cli/velvet_cli.dart';

void main(List<String> arguments) {
createVelvetCli().run(arguments);
}
copied to clipboard

Create a command. Create a commands folder inside bin folder and create a file with the command name. For example, if you want to create a command called hello, create a file called hello_command.dart in the commands folder with the following code:

import 'dart:async';

import 'package:velvet_cli/velvet_cli.dart';

class HelloCommand extends VelvetCommand {
@override
String get name => 'hello';

@override
String get description => 'Prints "Hello, World!"';

@override
FutureOr<void> run() {
print('Hello, World!');
}
}
copied to clipboard

Register the command. Open the main.dart file in the bin folder and add the following code:

import 'package:velvet_cli/velvet_cli.dart';

import 'commands/hello_command.dart';

void main(List<String> arguments) {
createVelvetCli()
..withCommands((commandHandler) {
commandHandler.add(HelloCommand());
})
..run(arguments);
}
copied to clipboard

Finally, add executables in pubspec.yaml:

executables:
your_project_name:
copied to clipboard

Run the command:

flutter run your_project_name:main hello
copied to clipboard
Contributing #
If you would like to contribute to Velvet, please read the contributing guidelines before submitting a pull request.
License #
Velvet is released under the MIT License.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.