-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: start of command line interface
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ version = "0.1.0" | |
edition = "2021" | ||
|
||
[dependencies] | ||
|
||
clap = "4.5.21" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,40 @@ | ||
use clap::{Command, Arg}; | ||
|
||
fn cli() -> Command { | ||
Command::new("git-lfs-synology") | ||
.about("This is an implementation of a git lfs custom transfer agent. See https://github.com/git-lfs/git-lfs/blob/main/docs/custom-transfers.md for mor information.") | ||
.allow_external_subcommands(true) | ||
.subcommand( | ||
Command::new("login") | ||
.about("Allows logging into the Synology NAS.") | ||
.args_conflicts_with_subcommands(true) | ||
.flatten_help(true) | ||
.arg( | ||
Arg::new("USER") | ||
.short('u') | ||
.long("user") | ||
.required(true) | ||
.help("The username for the Synology NAS") | ||
) | ||
.arg( | ||
Arg::new("URL") | ||
.short('l') | ||
.long("url") | ||
.required(true) | ||
.help("The URL for the Synology NAS") | ||
) | ||
) | ||
} | ||
|
||
fn main() { | ||
println!("Hello, world!"); | ||
let matches = cli().get_matches(); | ||
|
||
match matches.subcommand() { | ||
Some(("login", sub_matches)) => { | ||
println!("{:?}", sub_matches); | ||
|
||
println!("login") | ||
}, | ||
_ => println!("No subcommand") | ||
} | ||
} |