Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/cmd/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ pub fn deploy(opts: DeployOptions) -> Result<(), Box<dyn Error>> {
// force a no-skip-git
let conf = config::read_and_validate_config()?;

config::update_time(conf)?;
println!("Committing files to remote...");
git(repo_path, &["add", "."])?;
git(repo_path, &["commit", "-m", "Add new course"])?;
git(repo_path, &["commit", "-m", &format!("Add course: {}", conf.title)])?;
git(repo_path, &["push"])?;

config::update_time(conf)?;

println!("Project successfully pushed to remote.");

Expand Down
18 changes: 14 additions & 4 deletions src/cmd/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,32 @@ use std::{
use clap::Args;

use crate::{
cmd::run,
net::kill_port,
puppeteer::{is_puppeteer_chrome_installed, prompt_install_puppeteer_chrome},
cmd::run, config::read_and_validate_config, net::kill_port, puppeteer::{is_puppeteer_chrome_installed, prompt_install_puppeteer_chrome}
};

/// Options struct for the export subcommand
#[derive(Args, Debug, Clone)]
pub struct ExportOptions {
/// String name of the output PDF file
#[arg(long, default_value = "slides.pdf")]
#[arg(long, default_value_t = get_default_output())]
pub output: String,
/// Port the project runs on
#[arg(long, default_value_t = 3000)]
pub port: u16,
}

fn get_default_output() -> String {
let default = String::from("slides.pdf");

let Ok(config) = read_and_validate_config() else {
println!("Warning: Could not read oseda-config.json");
println!("Using slides.pdf as name instead");
return default;
};

return format!("{}.pdf", config.title.trim());
}

/// Export the current Oseda project to a PDF file via `decktape`
pub fn export(opts: ExportOptions) -> Result<(), Box<dyn Error>> {
println!("Cleaning any existing oseda processing...");
Expand Down
Loading