Skip to content

Usage ​

Reference for the corvis commands. Options start with -- and can go in any position after the command.

corvis new ​

bash
corvis new <name> [--corvis-path <path>] [--corvis-version <requirement>] [--skip-git]

Creates the project folder (the name in kebab-case) with Cargo.toml, .env, .gitignore and src/ with main.rs, app_module.rs, app_controller.rs and app_service.rs. It fails if the folder already exists.

OptionEffect
--corvis-path <path>Dependency corvis = { path = "<path>" }. Without it, CORVIS_PATH or the copy the CLI was built from is used
--corvis-version <requirement>Dependency corvis = { version = "<requirement>" } (a Cargo version requirement)
--skip-gitDoes not run git init

The name must start with a letter and contain only letters, digits, - and _.

corvis generate ​

bash
corvis generate <schematic> <name> [--flat] [--path <module>] [--no-spec]
corvis g <schematic> <name> ...

It runs inside a project: it searches upward for the first folder with Cargo.toml and src/.

Schematics ​

SchematicAliasGeneratesRegisters it in
modulemoXModuleimports of AppModule
controllercoXController with a GET and a testcontrollers of the folder's module, or of AppModule
servicesXService (#[injectable]) with a testproviders of the folder's module, or of AppModule
resourceresModule, CRUD controller, service, DTOs, entity and testimports of AppModule
guardguXGuard (CanActivate)Not registered
interceptoritc, inXInterceptor (CorvisInterceptor)Not registered
pipepiXPipe (PipeTransform)Not registered
filterfXFilter (ExceptionFilter)Not registered
middlewaremiXMiddleware (CorvisMiddleware)Not registered
gatewaygaXGateway (#[websocket_gateway])providers of the folder's module, or of AppModule

Guards, interceptors, pipes, filters and middleware are not registered because they are used with #[use_guards(...)], #[use_interceptors(...)], consumer.apply::<...>() or the use_global_* methods, depending on the case.

Where the files are written ​

With corvis g service users:

text
src/
├── main.rs          # + mod users;
├── app_module.rs    # + providers = [UsersService] (if src/users/users_module.rs does not exist)
└── users/
    ├── mod.rs       # + pub mod users_service; pub use users_service::UsersService;
    └── users_service.rs

If src/users/users_module.rs exists (for example, because you ran corvis g module users earlier), the service is registered in UsersModule instead of AppModule. The CLI also adds the necessary use lines.

The exact rule is: it looks for src/<folder>/<name>_module.rs and, if it does not exist, uses src/app_module.rs. That is why corvis g controller profile --path users looks for src/users/profile_module.rs and, not finding it, registers the controller in AppModule even if users_module.rs exists; in that case, move it by hand to the right module.

OptionEffect
--flatWrites the file in src/ (src/users_service.rs) instead of a folder
--path <module>Uses another folder: corvis g controller profile --path users writes to src/users/. It must be a valid Rust module name
--no-specOmits the #[cfg(test)] module from the generated file

If a file already exists, the command fails without overwriting it. When the CLI does not recognize the shape of a file it has to modify, it reports SKIP and you have to do the registration by hand.

Type names are derived from the argument: user-profile, user_profile and UserProfile produce UserProfileService in user_profile_service.rs, with the route user-profile in controllers.

corvis start ​

bash
corvis start [--watch] [--release] [-- <program arguments>]
FormRuns
corvis startcargo run
corvis start --release (or --prod)cargo run --release
corvis start -- --my-flagcargo run -- --my-flag
corvis start --watchcargo watch -x run

--watch needs cargo-watch (cargo install cargo-watch). In that mode, --release and the arguments after -- are ignored.

corvis build ​

bash
corvis build [--release]

Runs cargo build, or cargo build --release with --release (or --prod).

corvis info ​

Shows the operating system and architecture, rustc --version, cargo --version and the CLI version. Useful to attach to a bug report.

Released under the MIT License.