bw/vault/
mod.rs

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