Skip to content

Commit

Permalink
zet create command created
Browse files Browse the repository at this point in the history
  • Loading branch information
peterramaldes committed Oct 29, 2023
1 parent cc35f40 commit f5afa92
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 2 deletions.
122 changes: 122 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ repository = "https://github.com/peterramaldes/zet.git"

[dependencies]
chrono = "0.4.31"
clap = { version = "4.4.7", features = ["derive"] }
25 changes: 23 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
pub mod create;

use clap::Parser;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Cli {
/// The subcommand after `zet` that the program will run
#[clap(subcommand)]
subcommand: Subcommand,
}

#[derive(Parser, Debug)]
enum Subcommand {
/// Create the Zettelkasten markdown file and open it using the default $EDITOR or `vi` if
/// the env isn´t set.
#[clap(visible_alias = "c")]
Create,
}

fn main() -> std::io::Result<()> {
create::run()?;
Ok(())
let cli = Cli::parse();

return match cli.subcommand {
Subcommand::Create => create::run(),
};

Check warning on line 26 in src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded `return` statement

warning: unneeded `return` statement --> src/main.rs:24:5 | 24 | / return match cli.subcommand { 25 | | Subcommand::Create => create::run(), 26 | | }; | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return = note: `#[warn(clippy::needless_return)]` on by default help: remove `return` | 24 ~ match cli.subcommand { 25 + Subcommand::Create => create::run(), 26 ~ } |
}

0 comments on commit f5afa92

Please sign in to comment.