diff --git a/Cargo.lock b/Cargo.lock index c816252b5..c705f69ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -170,6 +170,7 @@ dependencies = [ "fish-tempfile", "fish-util", "fish-wcstringutil", + "fish-wgetopt", "fish-widecharwidth", "fish-widestring", "libc", @@ -305,6 +306,14 @@ dependencies = [ "rsconf", ] +[[package]] +name = "fish-wgetopt" +version = "0.0.0" +dependencies = [ + "fish-wcstringutil", + "fish-widestring", +] + [[package]] name = "fish-widecharwidth" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index c729bd094..ec0e54492 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ fish-util = { path = "crates/util" } fish-wcstringutil = { path = "crates/wcstringutil" } fish-widecharwidth = { path = "crates/widecharwidth" } fish-widestring = { path = "crates/widestring" } +fish-wgetopt = { path = "crates/wgetopt" } libc = "0.2.177" # lru pulls in hashbrown by default, which uses a faster (though less DoS resistant) hashing algo. # disabling default features uses the stdlib instead, but it doubles the time to rewrite the history @@ -107,6 +108,7 @@ fish-util.workspace = true fish-wcstringutil.workspace = true fish-widecharwidth.workspace = true fish-widestring.workspace = true +fish-wgetopt.workspace = true libc.workspace = true lru.workspace = true macro_rules_attribute = "0.2.2" diff --git a/contrib/debian/copyright b/contrib/debian/copyright index f6915912e..5cceaeecb 100644 --- a/contrib/debian/copyright +++ b/contrib/debian/copyright @@ -34,7 +34,7 @@ Copyright: 1990-2007 Free Software Foundation, Inc. 2022 fish-shell contributors License: GPL-2+ -Files: src/wgetopt.rs +Files: crates/wgetopt/src/wgetopt.rs Copyright: 1989-1994 Free Software Foundation, Inc. License: LGPL-2+ diff --git a/crates/wgetopt/Cargo.toml b/crates/wgetopt/Cargo.toml new file mode 100644 index 000000000..aff82797d --- /dev/null +++ b/crates/wgetopt/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "fish-wgetopt" +edition.workspace = true +rust-version.workspace = true +version = "0.0.0" +repository.workspace = true +license.workspace = true + +[dependencies] +fish-wcstringutil.workspace = true +fish-widestring.workspace = true + +[lints] +workspace = true diff --git a/src/wgetopt.rs b/crates/wgetopt/src/lib.rs similarity index 100% rename from src/wgetopt.rs rename to crates/wgetopt/src/lib.rs diff --git a/src/bin/fish.rs b/src/bin/fish.rs index b526beb32..042a8f3bb 100644 --- a/src/bin/fish.rs +++ b/src/bin/fish.rs @@ -215,7 +215,7 @@ fn run_command_list(parser: &Parser, cmds: &[OsString]) -> Result<(), libc::c_in } fn fish_parse_opt(args: &mut [WString], opts: &mut FishCmdOpts) -> ControlFlow { - use fish::wgetopt::{ArgType::*, WGetopter, WOption, wopt}; + use fish_wgetopt::{ArgType::*, WGetopter, WOption, wopt}; const RUSAGE_ARG: char = 1 as char; const PRINT_DEBUG_CATEGORIES_ARG: char = 2 as char; diff --git a/src/builtins/fish_indent.rs b/src/builtins/fish_indent.rs index ba456a97a..1e71b7b12 100644 --- a/src/builtins/fish_indent.rs +++ b/src/builtins/fish_indent.rs @@ -29,9 +29,9 @@ use crate::threads; use crate::tokenizer::{TOK_SHOW_BLANK_LINES, TOK_SHOW_COMMENTS, TokenType, Tokenizer}; use crate::topic_monitor::topic_monitor_init; -use crate::wgetopt::{ArgType, WGetopter, WOption, wopt}; use crate::wutil::fish_iswalnum; use fish_wcstringutil::count_preceding_backslashes; +use fish_wgetopt::{ArgType, WGetopter, WOption, wopt}; /// Note: this got somewhat more complicated after introducing the new AST, because that AST no /// longer encodes detailed lexical information (e.g. every newline). This feels more complex diff --git a/src/builtins/fish_key_reader.rs b/src/builtins/fish_key_reader.rs index a69c724ee..71638b0cd 100644 --- a/src/builtins/fish_key_reader.rs +++ b/src/builtins/fish_key_reader.rs @@ -32,8 +32,8 @@ threads, topic_monitor::topic_monitor_init, tty_handoff::TtyHandoff, - wgetopt::{ArgType, WGetopter, WOption, wopt}, }; +use fish_wgetopt::{ArgType, WGetopter, WOption, wopt}; use super::prelude::*; diff --git a/src/builtins/jobs.rs b/src/builtins/jobs.rs index b9d6edb0c..77a226539 100644 --- a/src/builtins/jobs.rs +++ b/src/builtins/jobs.rs @@ -7,8 +7,8 @@ use crate::localization::{wgettext, wgettext_fmt}; use crate::parser::Parser; use crate::proc::{HAVE_PROC_STAT, Job, clock_ticks_to_seconds, proc_get_jiffies}; -use crate::wgetopt::{ArgType, WGetopter, WOption, wopt}; use crate::wutil::fish_wcstoi; +use fish_wgetopt::{ArgType, WGetopter, WOption, wopt}; use fish_widestring::{L, WExt, WString, wstr}; use std::num::NonZeroU32; diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs index eaccf60ff..4a3f60142 100644 --- a/src/builtins/mod.rs +++ b/src/builtins/mod.rs @@ -59,10 +59,10 @@ mod prelude { io::{IoStreams, SeparationType}, parser::Parser, prelude::*, - wgetopt::{ - ArgType::{self, *}, - NON_OPTION_CHAR, WGetopter, WOption, wopt, - }, wutil::{fish_wcstoi, fish_wcstol, fish_wcstoul}, }; + pub(crate) use fish_wgetopt::{ + ArgType::{self, *}, + NON_OPTION_CHAR, WGetopter, WOption, wopt, + }; } diff --git a/src/lib.rs b/src/lib.rs index baf131743..84e8c7016 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,7 +74,6 @@ pub mod tty_handoff; pub mod universal_notifier; pub mod wait_handle; -pub mod wgetopt; pub mod wildcard; #[cfg(feature = "gettext-extract")] diff --git a/src/text_face.rs b/src/text_face.rs index e5472224c..a71e79d43 100644 --- a/src/text_face.rs +++ b/src/text_face.rs @@ -1,7 +1,7 @@ use crate::prelude::*; use crate::terminal::{self, get_color_support}; -use crate::wgetopt::{ArgType, WGetopter, WOption, wopt}; use fish_color::Color; +use fish_wgetopt::{ArgType, WGetopter, WOption, wopt}; trait StyleSet { fn union_prefer_right(self, other: Self) -> Self;