Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed Sep 19, 2024
1 parent 2212600 commit ab14e8f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
47 changes: 39 additions & 8 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,21 @@ enum ComponentArg {
/// Actions
actions: Vec<String>,

/// The kind of scaffold to generate
#[clap(short, long, value_enum, default_value_t = gen::ScaffoldKind::Api)]
kind: gen::ScaffoldKind,
/// The kind of controller actions to generate
#[clap(short, long, value_enum, group = "scaffold_kind_group")]
kind: Option<gen::ScaffoldKind>,

/// Use HTMX controller actions
#[clap(long, group = "scaffold_kind_group")]
htmx: bool,

/// Use HTML controller actions
#[clap(long, group = "scaffold_kind_group")]
html: bool,

/// Use API controller actions
#[clap(long, group = "scaffold_kind_group")]
api: bool,
},
/// Generate a Task based on the given name
Task {
Expand Down Expand Up @@ -256,11 +268,30 @@ impl TryFrom<ComponentArg> for Component {
name,
actions,
kind,
} => Ok(Self::Controller {
name,
actions,
kind,
}),
htmx,
html,
api,
} => {
let kind = if let Some(kind) = kind {
kind
} else if htmx {
ScaffoldKind::Htmx
} else if html {
ScaffoldKind::Html
} else if api {
ScaffoldKind::Api
} else {
return Err(crate::Error::string(
"Error: One of `kind`, `htmx`, `html`, or `api` must be specified.",
));
};

Ok(Self::Controller {
name,
actions,
kind,
})
}
ComponentArg::Task { name } => Ok(Self::Task { name }),
ComponentArg::Scheduler {} => Ok(Self::Scheduler {}),
ComponentArg::Worker { name } => Ok(Self::Worker { name }),
Expand Down
2 changes: 1 addition & 1 deletion src/controller/fallback.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<body class="bg-gray-100 text-gray-900">
<div class="min-h-screen flex flex-col justify-center items-center py-8">
<div class=" shadow-md rounded-lg p-8 max-w-xl text-center">
<div class="bg-white shadow-md rounded-lg p-8 max-w-xl text-center">
<svg class="mx-auto my-4" width="113" height="" viewBox="0 0 413 413" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="mask0_201_516" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="413" height="413">
<circle cx="206.5" cy="206.5" r="206.5" fill="white"/>
Expand Down

0 comments on commit ab14e8f

Please sign in to comment.