rename to dynix
This commit is contained in:
parent
80ff0b36cb
commit
8477c73067
7 changed files with 43 additions and 43 deletions
16
src/main.rs
16
src/main.rs
|
|
@ -5,17 +5,17 @@ use std::path::{Path, PathBuf};
|
|||
use std::process::ExitCode;
|
||||
use std::{error::Error as StdError, sync::Arc};
|
||||
|
||||
use append_override::source::SourceFile;
|
||||
use dynix::source::SourceFile;
|
||||
use clap::{ColorChoice, Parser as _};
|
||||
use fs_err::File;
|
||||
use fs_err::os::unix::fs::OpenOptionsExt;
|
||||
|
||||
fn main_wrapped() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
|
||||
let args = append_override::Parser::parse();
|
||||
let args = dynix::Parser::parse();
|
||||
|
||||
dbg!(&args);
|
||||
|
||||
let success = append_override::CLI_ENABLE_COLOR.set(match args.color {
|
||||
let success = dynix::CLI_ENABLE_COLOR.set(match args.color {
|
||||
ColorChoice::Always => true,
|
||||
ColorChoice::Auto => io::stdin().is_terminal(),
|
||||
ColorChoice::Never => false,
|
||||
|
|
@ -34,7 +34,7 @@ fn main_wrapped() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
|
|||
};
|
||||
|
||||
// Get what file that thing is defined in.
|
||||
let def_path = append_override::get_where(&args.name, &filepath)?;
|
||||
let def_path = dynix::get_where(&args.name, &filepath)?;
|
||||
dbg!(&def_path);
|
||||
let def_path = Arc::from(def_path);
|
||||
let mut opts = File::options();
|
||||
|
|
@ -44,10 +44,10 @@ fn main_wrapped() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
|
|||
.custom_flags(libc::O_CLOEXEC);
|
||||
let source_file = SourceFile::open_from(Arc::clone(&def_path), opts)?;
|
||||
|
||||
let pri = append_override::get_highest_prio(&args.name, source_file.clone())?;
|
||||
let pri = dynix::get_highest_prio(&args.name, source_file.clone())?;
|
||||
let new_pri = pri - 1;
|
||||
|
||||
let new_pri_line = append_override::get_next_prio_line(
|
||||
let new_pri_line = dynix::get_next_prio_line(
|
||||
source_file.clone(),
|
||||
args.name.into(),
|
||||
new_pri,
|
||||
|
|
@ -56,7 +56,7 @@ fn main_wrapped() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
|
|||
|
||||
eprintln!("new_pri_line={new_pri_line}");
|
||||
|
||||
append_override::write_next_prio(source_file, new_pri_line)?;
|
||||
dynix::write_next_prio(source_file, new_pri_line)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ fn main() -> ExitCode {
|
|||
match main_wrapped() {
|
||||
Ok(_) => ExitCode::SUCCESS,
|
||||
Err(e) => {
|
||||
eprintln!("append-override: error: {}", e);
|
||||
eprintln!("dynix: error: {}", e);
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue