bw/vault/
mod.rs

1use clap::Subcommand;
2
3use crate::render::{CommandOutput, CommandResult};
4
5#[derive(Subcommand, Clone)]
6pub enum ItemCommands {
7    Get { id: String },
8    Create {},
9}
10
11#[derive(Subcommand, Clone)]
12
13pub enum TemplateCommands {
14    #[command(name = "item")]
15    Item,
16    #[command(name = "item.field")]
17    ItemField,
18    #[command(name = "item.login")]
19    ItemLogin,
20    #[command(name = "item.login.uri")]
21    ItemLoginUri,
22    #[command(name = "item.card")]
23    ItemCard,
24    #[command(name = "item.identity")]
25    ItemIdentity,
26    #[command(name = "item.securenote")]
27    ItemSecureNote,
28    #[command(name = "folder")]
29    Folder,
30    #[command(name = "collection")]
31    Collection,
32    #[command(name = "item-collections")]
33    ItemCollections,
34    #[command(name = "org-collection")]
35    OrgCollection,
36    #[command(name = "send.text")]
37    SendText,
38    #[command(name = "send.file")]
39    SendFile,
40}
41
42impl TemplateCommands {
43    pub fn run(&self) -> CommandResult {
44        match self {
45            Self::Folder => {
46                #[derive(serde::Serialize)]
47                struct FolderTemplate {
48                    name: String,
49                }
50
51                Ok(CommandOutput::Object(Box::new(FolderTemplate {
52                    name: "Folder name".to_string(),
53                })))
54            }
55            _ => todo!(),
56        }
57    }
58}