Expand description
cargo kick g — codegen into an existing kick-rs project.
Currently ships:
g module <name>— emitsrc/modules/<name>/{mod.rs,handlers.rs}and appendpub mod <name>;tosrc/modules/mod.rs.g service <module>/<name>— emitsrc/modules/<module>/<name>.rscontaining a#[service]-derived stub, and appendpub mod <name>;to the parent module’smod.rs.g contributor <module>/<name>— emitsrc/modules/<module>/<name>.rscontaining a#[contributor]async fn + Output struct, and appendpub mod <name>;to the parent module’smod.rs.
Project root is auto-detected by walking up from cwd until we
find a directory containing src/modules/mod.rs. That single
anchor is what makes us “in a kick-rs project” for the purposes of
this command.
Structs§
- Generate
Contributor Args - Decoded form of the
g contributorsubcommand. - Generate
Contributor Result - Result of
generate_contributor. - Generate
Module Args - Decoded form of the
g modulesubcommand. - Generate
Module Result - Result of
generate_module— the directory written + how themain.rsauto-register attempt fared. - Generate
Service Args - Decoded form of the
g servicesubcommand. - Generate
Service Result - Result of
generate_service— the file written + auto-register outcome.
Enums§
Functions§
- find_
project_ root - Walk up from
startuntil we find a directory containingsrc/modules/mod.rs. That’s our project root. - generate_
contributor - Run the
g contributor <module>/<contributor_snake>flow. - generate_
module - Run the
g module <name>flow. - generate_
service - Run the
g service <module>/<service_snake>flow. - to_
pascal_ case - Convert a snake_case identifier to PascalCase. Used to derive the
service struct name from its file name (
email_sender→EmailSender). - validate_
module_ name - Module-name validation. Snake-case only — hyphens disallowed because Rust modules can’t have them.