-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to change directory to load dependant asset files (transit…
…ion images)
- Loading branch information
Showing
7 changed files
with
68 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use std::path::PathBuf; | ||
|
||
use clap::{command, Parser}; | ||
|
||
use crate::prelude::Duration; | ||
|
||
#[derive(Parser, Debug, Clone)] | ||
#[command( | ||
name = "rusty-slider", | ||
about = "A small tool to display markdown files as a slideshow." | ||
)] | ||
pub struct AppOptions { | ||
/// Path to directory to load slideshow files from | ||
#[arg(short, long, default_value = "assets")] | ||
pub directory: PathBuf, | ||
/// Markdown files with slides text. | ||
#[arg(short, long, default_value = "rusty-slider.md")] | ||
pub slides: PathBuf, | ||
/// File with theme options. | ||
#[arg(short, long, default_value = "default-theme.json")] | ||
pub theme: PathBuf, | ||
/// Automatically switch slides every N seconds. | ||
#[arg(short, long, default_value = "0")] | ||
pub automatic: Duration, | ||
/// Switch transitions for every slide | ||
#[arg(long)] | ||
pub demo_transitions: bool, | ||
/// When taking screenshot, store PNG at this path | ||
#[arg(short = 'S', long, default_value = "screenshot.png")] | ||
pub screenshot: PathBuf, | ||
/// Enable executing code in code blocks | ||
#[arg(long)] | ||
pub enable_code_execution: bool, | ||
/// Path to directory where application files are loaded from | ||
#[arg(short = 'A', long, default_value = "assets")] | ||
pub assets: PathBuf, | ||
} | ||
|
||
impl AppOptions { | ||
pub fn slides_path(&self) -> PathBuf { | ||
let mut path = self.directory.clone(); | ||
path.push(self.slides.clone()); | ||
path | ||
} | ||
|
||
pub fn theme_path(&self) -> PathBuf { | ||
let mut path = self.directory.clone(); | ||
path.push(self.theme.clone()); | ||
path | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod app_options; | ||
pub mod clipboard; | ||
pub mod code_box_builder; | ||
pub mod codebox; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters