summaryrefslogtreecommitdiff
path: root/src/cmd/list.rs
blob: 66036b91609afe2a2ad414e009f68c75a1df1e5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::client::BackupClient;
use crate::config::ClientConfig;
use crate::error::ObnamError;
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
pub struct List {}

impl List {
    pub fn run(&self, config: &ClientConfig) -> Result<(), ObnamError> {
        let client = BackupClient::new(config)?;

        let generations = client.list_generations()?;
        for finished in generations.iter() {
            println!("{} {}", finished.id(), finished.ended());
        }

        Ok(())
    }
}