mirror of
https://github.com/spikecodes/libreddit
synced 2024-12-25 18:15:16 +01:00
1e418619f1
Add the ability to search for specific comments within posts. Known issues: - Just like on reddit, this does not work with comment sorting. The sorting order is ignored during the search and changing the sorting order after the search does not change anything. I do not think we can fix this before reddit does, since in my understanding we rely on them for the sorting. However we could implement a default sorting method ourselves by taking the vector of comments returned from the search and sorting it manually. - The UI could be improved on mobile. On screens with a max width inferior to 480 pixels, the comment search bar is displayed below the comment sorting form. It would be great if we could make the search bar have the same width as the whole comment sorting form but I do not have the willpower to write any more css.
25 lines
595 B
Rust
25 lines
595 B
Rust
use std::process::{Command, ExitStatus, Output};
|
|
|
|
#[cfg(not(target_os = "windows"))]
|
|
use std::os::unix::process::ExitStatusExt;
|
|
|
|
#[cfg(target_os = "windows")]
|
|
use std::os::windows::process::ExitStatusExt;
|
|
|
|
fn main() {
|
|
let output = String::from_utf8(
|
|
Command::new("git")
|
|
.args(["rev-parse", "HEAD"])
|
|
.output()
|
|
.unwrap_or(Output {
|
|
stdout: vec![],
|
|
stderr: vec![],
|
|
status: ExitStatus::from_raw(0),
|
|
})
|
|
.stdout,
|
|
)
|
|
.unwrap_or_default();
|
|
let git_hash = if output == String::default() { "dev".into() } else { output };
|
|
println!("cargo:rustc-env=GIT_HASH={git_hash}");
|
|
}
|