Skip to content

Commit

Permalink
Use shadow-rs to show detailed version information (kamiyaa#481)
Browse files Browse the repository at this point in the history
* feat: use `shadow-rs` to show detailed version information

* fix: fix lints and errors
  • Loading branch information
xrelkd authored Jan 20, 2024
1 parent 71332cd commit 33a5dba
Show file tree
Hide file tree
Showing 8 changed files with 286 additions and 5 deletions.
267 changes: 267 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ rand = "^0"
regex = "1.9.3"
rustyline = "^12"
serde = { version = "^1", features = ["derive"] }
shadow-rs = "0.26"
shell-words = "^1"
shellexpand = { version = "^3", features = ["full"] }
signal-hook = "^0"
Expand All @@ -58,6 +59,9 @@ features = ["termion"]
version = "^1"
features = ["v4", "fast-rng", "macro-diagnostics"]

[build-dependencies]
shadow-rs = "0.26"

[features]
devicons = ["phf"]
file_mimetype = []
Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() -> shadow_rs::SdResult<()> {
shadow_rs::new()
}
2 changes: 1 addition & 1 deletion src/commands/open_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub fn open(context: &mut AppContext, backend: &mut AppBackend) -> AppResult {
(entry.file_path(), vec![entry.file_name()])
} else {
(
paths.get(0).unwrap().file_path(),
paths.first().unwrap().file_path(),
paths.iter().map(|e| e.file_name()).collect(),
)
};
Expand Down
1 change: 0 additions & 1 deletion src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ pub mod app_event;
pub mod process_event;

pub use self::app_event::*;
pub use self::process_event::*;
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod io;
mod key_command;
mod preview;
mod run;
mod shadow;
mod tab;
mod traits;
mod ui;
Expand Down Expand Up @@ -219,8 +220,11 @@ fn run_quit(args: &Args, context: &AppContext) -> Result<(), AppError> {
}

fn print_version() -> Result<i32, AppError> {
let version = env!("CARGO_PKG_VERSION");
writeln!(&mut std::io::stdout(), "{PROGRAM_NAME}-{version}")?;
writeln!(
&mut std::io::stdout(),
"{PROGRAM_NAME}-{}",
shadow::CLAP_LONG_VERSION
)?;
Ok(0)
}

Expand Down
5 changes: 5 additions & 0 deletions src/shadow.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#![allow(clippy::needless_raw_string_hashes)]
use shadow_rs::shadow;
shadow!(build);

pub use self::build::*;
1 change: 0 additions & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ pub mod widgets;
pub use backend::*;
pub use preview_area::*;
pub use rect::*;
pub use tab_list_builder::*;

0 comments on commit 33a5dba

Please sign in to comment.