Browse Source

edit begin

fix-typo
Coin de Gamma 3 months ago
parent
commit
791606ad1b
  1. 28
      src/main.rs

28
src/main.rs

@ -27,20 +27,24 @@ enum Commands {
/// Lists all ids stored in db
List,
/// Show content of item
Show {
#[arg(value_name="item_id")]
id: String
},
/// Adds new item with unique id to the db
Add {
#[arg(value_name="item_id")]
id: String
},
/// Show content of item
Show {
/// Edit item content
Edit {
#[arg(value_name="item_id")]
id: String
}
// TODO: edit
}
enum PROMPT {
@ -130,6 +134,11 @@ fn add(id: &String) -> io::Result<()> {
Ok(())
}
fn edit(id: &String) -> io::Result<()> {
// TODO: implement
Ok(())
}
fn show(id: &String) -> io::Result<()> {
let passphrase = login()?;
let mut st = Storage::from_db(passphrase)?;
@ -151,14 +160,17 @@ fn run_command() -> io::Result<()> {
Some(Commands::Init) => {
init()?;
}
Some(Commands::Add{ id }) => {
add(id)?;
Some(Commands::List) => {
list()?;
}
Some(Commands::Show { id }) => {
show(id)?;
}
Some(Commands::List) => {
list()?;
Some(Commands::Add { id }) => {
add(id)?;
}
Some(Commands::Edit { id }) => {
edit(id)?
}
None => {
if !Storage::is_inited() {

Loading…
Cancel
Save