Files
asciinema/src/cmd/upload.rs

22 lines
498 B
Rust
Raw Normal View History

use crate::api;
use crate::asciicast;
use crate::config::Config;
use anyhow::Result;
use clap::Args;
2023-12-21 16:23:40 +01:00
#[derive(Debug, Args)]
pub struct Cli {
/// Filename/path of asciicast to upload
filename: String,
}
impl Cli {
pub fn run(self, config: &Config) -> Result<()> {
let _ = asciicast::open_from_path(&self.filename)?;
let response = api::upload_asciicast(&self.filename, config)?;
println!("{}", response.message.unwrap_or(response.url));
2023-12-21 16:23:40 +01:00
Ok(())
}
}