Skip to content

Commit a6450c9

Browse files
committed
Make command required.
1 parent 4f18fe6 commit a6450c9

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/app.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub struct App {
5353
pub globals: Globals,
5454
/// The subcommand to run, if any.
5555
#[command(subcommand)]
56-
pub command: Option<Command>,
56+
pub command: Command,
5757
}
5858

5959
/// Represents sources of errors that can occur during application runs.
@@ -155,19 +155,17 @@ impl App {
155155
discover().map_err(Error::discover)?
156156
};
157157

158-
if let Some(command) = self.command {
159-
match command {
160-
Command::Build(build) => {
161-
build.run(workspace).map_err(Error::build)?;
162-
}
163-
Command::Preview(preview) => {
164-
preview.run(workspace).map_err(Error::preview)?;
165-
}
166-
Command::Create(create) => {
167-
let directory = workspace.config.paths.directory;
168-
169-
create.run(directory).map_err(Error::create)?;
170-
}
158+
match self.command {
159+
Command::Build(build) => {
160+
build.run(workspace).map_err(Error::build)?;
161+
}
162+
Command::Preview(preview) => {
163+
preview.run(workspace).map_err(Error::preview)?;
164+
}
165+
Command::Create(create) => {
166+
let directory = workspace.config.paths.directory;
167+
168+
create.run(directory).map_err(Error::create)?;
171169
}
172170
};
173171

0 commit comments

Comments
 (0)