Adopt the builtin prelude

This commit is contained in:
Henrik Hørlück Berg 2023-08-09 00:17:10 +02:00 committed by Johannes Altmanninger
parent 773bafb7c7
commit 131e249b0c
26 changed files with 56 additions and 269 deletions

View file

@ -1,20 +1,10 @@
use super::prelude::*;
use crate::abbrs::{self, Abbreviation, Position}; use crate::abbrs::{self, Abbreviation, Position};
use crate::builtins::shared::{
builtin_missing_argument, builtin_print_error_trailer, builtin_print_help,
builtin_unknown_option, io_streams_t, BUILTIN_ERR_TOO_MANY_ARGUMENTS, STATUS_CMD_ERROR,
STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::common::{escape, escape_string, valid_func_name, EscapeStringStyle}; use crate::common::{escape, escape_string, valid_func_name, EscapeStringStyle};
use crate::env::status::{ENV_NOT_FOUND, ENV_OK}; use crate::env::status::{ENV_NOT_FOUND, ENV_OK};
use crate::env::EnvMode; use crate::env::EnvMode;
use crate::ffi::parser_t;
use crate::re::{regex_make_anchored, to_boxed_chars}; use crate::re::{regex_make_anchored, to_boxed_chars};
use crate::wchar::{wstr, L};
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::wgettext_fmt;
use libc::c_int;
use pcre2::utf32::{Regex, RegexBuilder}; use pcre2::utf32::{Regex, RegexBuilder};
pub use widestring::Utf32String as WString;
const CMD: &wstr = L!("abbr"); const CMD: &wstr = L!("abbr");

View file

@ -1,20 +1,10 @@
use std::collections::HashMap; use std::collections::HashMap;
use crate::builtins::shared::builtin_print_error_trailer; use super::prelude::*;
use crate::builtins::shared::{
builtin_missing_argument, builtin_print_help, builtin_unknown_option, io_streams_t,
BUILTIN_ERR_MAX_ARG_COUNT1, BUILTIN_ERR_MIN_ARG_COUNT1, BUILTIN_ERR_UNKNOWN, STATUS_CMD_ERROR,
STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::env::{EnvMode, EnvStack}; use crate::env::{EnvMode, EnvStack};
use crate::ffi::parser_t;
use crate::ffi::Repin;
use crate::wchar::{wstr, WString, L};
use crate::wchar_ext::WExt;
use crate::wcstringutil::split_string; use crate::wcstringutil::split_string;
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t, NONOPTION_CHAR_CODE}; use crate::wutil::fish_iswalnum;
use crate::wutil::{fish_iswalnum, fish_wcstol, wgettext_fmt};
use libc::c_int;
const VAR_NAME_PREFIX: &wstr = L!("_flag_"); const VAR_NAME_PREFIX: &wstr = L!("_flag_");
@ -99,8 +89,6 @@ fn exec_subshell(
) -> Option<c_int> { ) -> Option<c_int> {
use crate::ffi::exec_subshell_ffi; use crate::ffi::exec_subshell_ffi;
use crate::wchar_ffi::wcstring_list_ffi_t; use crate::wchar_ffi::wcstring_list_ffi_t;
use crate::wchar_ffi::WCharFromFFI;
use crate::wchar_ffi::WCharToFFI;
let mut cmd_output: cxx::UniquePtr<wcstring_list_ffi_t> = wcstring_list_ffi_t::create(); let mut cmd_output: cxx::UniquePtr<wcstring_list_ffi_t> = wcstring_list_ffi_t::create();
let retval = Some( let retval = Some(

View file

@ -2,15 +2,7 @@
use std::pin::Pin; use std::pin::Pin;
use super::shared::{builtin_print_help, io_streams_t, STATUS_CMD_ERROR, STATUS_INVALID_ARGS}; use super::prelude::*;
use crate::{
builtins::shared::{HelpOnlyCmdOpts, STATUS_CMD_OK},
ffi::{self, parser_t, Repin},
wchar::wstr,
wchar_ffi::{c_str, WCharFromFFI, WCharToFFI},
wutil::{fish_wcstoi, wgettext_fmt},
};
use libc::c_int;
/// Helper function for builtin_bg(). /// Helper function for builtin_bg().
fn send_to_bg( fn send_to_bg(

View file

@ -1,16 +1,5 @@
// Implementation of the block builtin. // Implementation of the block builtin.
use super::shared::{ use super::prelude::*;
builtin_missing_argument, builtin_print_help, io_streams_t, STATUS_CMD_ERROR, STATUS_CMD_OK,
STATUS_INVALID_ARGS,
};
use crate::{
builtins::shared::builtin_unknown_option,
ffi::{parser_t, Repin},
wchar::{wstr, L},
wgetopt::{wgetopter_t, wopt, woption, woption_argument_t},
wutil::wgettext_fmt,
};
use libc::c_int;
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Scope { enum Scope {

View file

@ -1,16 +1,5 @@
use libc::c_int; use super::prelude::*;
use crate::builtins::shared::{
builtin_missing_argument, builtin_print_help, builtin_unknown_option, io_streams_t,
BUILTIN_ERR_COMBO2, STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::ffi::parser_t;
use crate::ffi::{builtin_exists, builtin_get_names_ffi}; use crate::ffi::{builtin_exists, builtin_get_names_ffi};
use crate::wchar::{wstr, WString, L};
use crate::wchar_ffi::WCharFromFFI;
use crate::wchar_ffi::WCharToFFI;
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::{wgettext, wgettext_fmt};
#[derive(Default)] #[derive(Default)]
struct builtin_cmd_opts_t { struct builtin_cmd_opts_t {

View file

@ -1,18 +1,14 @@
// Implementation of the cd builtin. // Implementation of the cd builtin.
use super::shared::{builtin_print_help, io_streams_t, STATUS_CMD_ERROR}; use super::prelude::*;
use crate::{ use crate::{
builtins::shared::{HelpOnlyCmdOpts, STATUS_CMD_OK},
env::{EnvMode, Environment}, env::{EnvMode, Environment},
fds::{wopen_cloexec, AutoCloseFd}, fds::{wopen_cloexec, AutoCloseFd},
ffi::{parser_t, Repin},
path::path_apply_cdpath, path::path_apply_cdpath,
wchar::{wstr, WString, L}, wutil::{normalize_path, wperror, wreadlink},
wchar_ffi::{WCharFromFFI, WCharToFFI},
wutil::{normalize_path, wgettext_fmt, wperror, wreadlink},
}; };
use errno::{self, Errno}; use errno::{self, Errno};
use libc::{c_int, fchdir, EACCES, ELOOP, ENOENT, ENOTDIR, EPERM, O_RDONLY}; use libc::{fchdir, EACCES, ELOOP, ENOENT, ENOTDIR, EPERM, O_RDONLY};
// The cd builtin. Changes the current directory to the one specified or to $HOME if none is // The cd builtin. Changes the current directory to the one specified or to $HOME if none is
// specified. The directory can be relative to any directory in the CDPATH variable. // specified. The directory can be relative to any directory in the CDPATH variable.

View file

@ -1,14 +1,5 @@
use libc::c_int; use super::prelude::*;
use crate::builtins::shared::{
builtin_missing_argument, builtin_print_help, builtin_unknown_option, io_streams_t,
STATUS_CMD_OK, STATUS_CMD_UNKNOWN, STATUS_INVALID_ARGS,
};
use crate::ffi::parser_t;
use crate::path::{path_get_path, path_get_paths}; use crate::path::{path_get_path, path_get_paths};
use crate::wchar::{wstr, L};
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::sprintf;
#[derive(Default)] #[derive(Default)]
struct command_cmd_opts_t { struct command_cmd_opts_t {

View file

@ -1,14 +1,5 @@
// Implementation of the contains builtin. // Implementation of the contains builtin.
use super::shared::{ use super::prelude::*;
builtin_missing_argument, builtin_print_help, io_streams_t, STATUS_CMD_ERROR, STATUS_CMD_OK,
STATUS_INVALID_ARGS,
};
use crate::builtins::shared::builtin_unknown_option;
use crate::ffi::parser_t;
use crate::wchar::{wstr, L};
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::wgettext_fmt;
use libc::c_int;
#[derive(Debug, Clone, Copy, Default)] #[derive(Debug, Clone, Copy, Default)]
struct Options { struct Options {

View file

@ -1,11 +1,7 @@
//! Implementation of the echo builtin. //! Implementation of the echo builtin.
use libc::c_int; use super::prelude::*;
use crate::wchar::encode_byte_to_char;
use super::shared::{builtin_missing_argument, io_streams_t, STATUS_CMD_OK, STATUS_INVALID_ARGS};
use crate::ffi::parser_t;
use crate::wchar::{encode_byte_to_char, wstr, WString, L};
use crate::wgetopt::{wgetopter_t, woption};
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
struct Options { struct Options {

View file

@ -1,10 +1,5 @@
use super::shared::{ use super::prelude::*;
builtin_print_help, io_streams_t, HelpOnlyCmdOpts, STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::event; use crate::event;
use crate::ffi::parser_t;
use crate::wchar::prelude::*;
use libc::c_int;
#[widestrs] #[widestrs]
pub fn emit( pub fn emit(

View file

@ -1,9 +1,5 @@
use libc::c_int; use super::prelude::*;
use super::r#return::parse_return_value; use super::r#return::parse_return_value;
use super::shared::io_streams_t;
use crate::ffi::parser_t;
use crate::wchar::wstr;
/// Function for handling the exit builtin. /// Function for handling the exit builtin.
pub fn exit( pub fn exit(

View file

@ -1,24 +1,16 @@
use super::shared::{ use super::prelude::*;
builtin_missing_argument, builtin_print_error_trailer, builtin_unknown_option, io_streams_t,
truncate_args_on_nul, BUILTIN_ERR_VARNAME, STATUS_INVALID_ARGS,
};
use crate::ast::BlockStatement; use crate::ast::BlockStatement;
use crate::builtins::shared::STATUS_CMD_OK;
use crate::common::{valid_func_name, valid_var_name}; use crate::common::{valid_func_name, valid_var_name};
use crate::env::environment::Environment; use crate::env::environment::Environment;
use crate::event::{self, EventDescription, EventHandler}; use crate::event::{self, EventDescription, EventHandler};
use crate::ffi::{self, io_streams_t as io_streams_ffi_t, parser_t, Repin}; use crate::ffi::io_streams_t as io_streams_ffi_t;
use crate::function; use crate::function;
use crate::global_safety::RelaxedAtomicBool; use crate::global_safety::RelaxedAtomicBool;
use crate::parse_tree::NodeRef; use crate::parse_tree::NodeRef;
use crate::parse_tree::ParsedSourceRefFFI; use crate::parse_tree::ParsedSourceRefFFI;
use crate::parser_keywords::parser_keywords_is_reserved; use crate::parser_keywords::parser_keywords_is_reserved;
use crate::signal::Signal; use crate::signal::Signal;
use crate::wchar::{wstr, WString, L};
use crate::wchar_ffi::{wcstring_list_ffi_t, WCharFromFFI, WCharToFFI}; use crate::wchar_ffi::{wcstring_list_ffi_t, WCharFromFFI, WCharToFFI};
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t, NONOPTION_CHAR_CODE};
use crate::wutil::{fish_wcstoi, wgettext_fmt};
use libc::c_int;
use std::pin::Pin; use std::pin::Pin;
use std::sync::Arc; use std::sync::Arc;

View file

@ -1,16 +1,9 @@
use libc::c_int;
use std::borrow::Cow; use std::borrow::Cow;
use super::shared::{ use super::prelude::*;
builtin_missing_argument, builtin_print_help, io_streams_t, BUILTIN_ERR_COMBO2,
BUILTIN_ERR_MIN_ARG_COUNT1, STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::common::{read_blocked, str2wcstring}; use crate::common::{read_blocked, str2wcstring};
use crate::ffi::parser_t;
use crate::tinyexpr::te_interp; use crate::tinyexpr::te_interp;
use crate::wchar::prelude::*; use crate::wutil::perror;
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::{fish_wcstoi, perror};
/// The maximum number of points after the decimal that we'll print. /// The maximum number of points after the decimal that we'll print.
const DEFAULT_SCALE: usize = 6; const DEFAULT_SCALE: usize = 6;

View file

@ -3,6 +3,7 @@ use std::cmp::Ordering;
use std::os::unix::prelude::{FileTypeExt, MetadataExt}; use std::os::unix::prelude::{FileTypeExt, MetadataExt};
use std::time::SystemTime; use std::time::SystemTime;
use super::prelude::*;
use crate::path::path_apply_working_directory; use crate::path::path_apply_working_directory;
use crate::util::wcsfilecmp_glob; use crate::util::wcsfilecmp_glob;
use crate::wcstringutil::split_string_tok; use crate::wcstringutil::split_string_tok;
@ -10,23 +11,8 @@ use crate::wutil::{
file_id_for_path, lwstat, normalize_path, waccess, wbasename, wdirname, wrealpath, wstat, file_id_for_path, lwstat, normalize_path, waccess, wbasename, wdirname, wrealpath, wstat,
INVALID_FILE_ID, INVALID_FILE_ID,
}; };
use crate::{
builtins::shared::{
builtin_missing_argument, builtin_print_error_trailer, builtin_print_help, io_streams_t,
Arguments, SplitBehavior, BUILTIN_ERR_ARG_COUNT0, BUILTIN_ERR_INVALID_SUBCMD,
BUILTIN_ERR_MISSING_SUBCMD, BUILTIN_ERR_TOO_MANY_ARGUMENTS, BUILTIN_ERR_UNKNOWN,
STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS,
},
ffi::{parser_t, separation_type_t},
wchar::{wstr, WString, L},
wchar_ext::{ToWString, WExt},
wgetopt::{wgetopter_t, wopt, woption, woption_argument_t::*, NONOPTION_CHAR_CODE},
wutil::wgettext_fmt,
};
use bitflags::bitflags; use bitflags::bitflags;
use libc::{ use libc::{getegid, geteuid, mode_t, uid_t, F_OK, PATH_MAX, R_OK, S_ISGID, S_ISUID, W_OK, X_OK};
c_int, getegid, geteuid, mode_t, uid_t, F_OK, PATH_MAX, R_OK, S_ISGID, S_ISUID, W_OK, X_OK,
};
use super::shared::BuiltinCmd; use super::shared::BuiltinCmd;

View file

@ -48,19 +48,17 @@
// This file has been imported from source code of printf command in GNU Coreutils version 6.9. // This file has been imported from source code of printf command in GNU Coreutils version 6.9.
use libc::c_int;
use num_traits; use num_traits;
use std::result::Result;
use crate::builtins::shared::{io_streams_t, STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS}; use super::prelude::*;
use crate::ffi::parser_t;
use crate::locale::{get_numeric_locale, Locale}; use crate::locale::{get_numeric_locale, Locale};
use crate::wchar::{encode_byte_to_char, wstr, WExt, WString, L}; use crate::wchar::encode_byte_to_char;
use crate::wutil::errors::Error; use crate::wutil::{
use crate::wutil::gettext::{wgettext, wgettext_fmt}; errors::Error,
use crate::wutil::wcstod::wcstod; wcstod::wcstod,
use crate::wutil::wcstoi::{wcstoi_partial, Options as WcstoiOpts}; wcstoi::{wcstoi_partial, Options as WcstoiOpts},
use crate::wutil::{sprintf, wstr_offset_in}; wstr_offset_in,
};
use printf_compat::args::ToArg; use printf_compat::args::ToArg;
use printf_compat::printf::sprintf_locale; use printf_compat::printf::sprintf_locale;

View file

@ -1,21 +1,8 @@
//! Implementation of the pwd builtin. //! Implementation of the pwd builtin.
use errno::errno; use errno::errno;
use libc::c_int;
use crate::{ use super::prelude::*;
builtins::shared::{io_streams_t, BUILTIN_ERR_ARG_COUNT1}, use crate::{env::EnvMode, wutil::wrealpath};
env::EnvMode,
ffi::parser_t,
wchar::{wstr, WString, L},
wchar_ffi::{WCharFromFFI, WCharToFFI},
wgetopt::{wgetopter_t, wopt, woption, woption_argument_t::no_argument},
wutil::{wgettext_fmt, wrealpath},
};
use super::shared::{
builtin_print_help, builtin_unknown_option, STATUS_CMD_ERROR, STATUS_CMD_OK,
STATUS_INVALID_ARGS,
};
// The pwd builtin. Respect -P to resolve symbolic links. Respect -L to not do that (the default). // The pwd builtin. Respect -P to resolve symbolic links. Respect -L to not do that (the default).
const short_options: &wstr = L!("LPh"); const short_options: &wstr = L!("LPh");

View file

@ -1,13 +1,6 @@
use libc::c_int; use super::prelude::*;
use crate::builtins::shared::{ use crate::wutil;
builtin_missing_argument, builtin_print_help, builtin_unknown_option, io_streams_t,
STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::ffi::parser_t;
use crate::wchar::{wstr, L};
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::{self, fish_wcstol, fish_wcstoul, sprintf, wgettext_fmt};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rand::rngs::SmallRng; use rand::rngs::SmallRng;
use rand::{Rng, SeedableRng}; use rand::{Rng, SeedableRng};

View file

@ -1,20 +1,11 @@
//! Implementation of the realpath builtin. //! Implementation of the realpath builtin.
use errno::errno; use errno::errno;
use libc::c_int;
use super::prelude::*;
use crate::{ use crate::{
ffi::parser_t,
path::path_apply_working_directory, path::path_apply_working_directory,
wchar::{wstr, WExt, L}, wutil::{normalize_path, wrealpath},
wchar_ffi::AsWstr,
wgetopt::{wgetopter_t, wopt, woption, woption_argument_t::no_argument},
wutil::{normalize_path, wgettext_fmt, wrealpath},
};
use super::shared::{
builtin_missing_argument, builtin_print_help, builtin_unknown_option, io_streams_t,
BUILTIN_ERR_ARG_COUNT1, STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS,
}; };
#[derive(Default)] #[derive(Default)]

View file

@ -1,18 +1,8 @@
// Implementation of the return builtin. // Implementation of the return builtin.
use libc::c_int;
use num_traits::abs; use num_traits::abs;
use super::shared::{ use super::prelude::*;
builtin_missing_argument, builtin_print_error_trailer, builtin_print_help, io_streams_t,
BUILTIN_ERR_NOT_NUMBER, STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::builtins::shared::BUILTIN_ERR_TOO_MANY_ARGUMENTS;
use crate::ffi::parser_t;
use crate::wchar::{wstr, L};
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::fish_wcstoi;
use crate::wutil::wgettext_fmt;
#[derive(Debug, Clone, Copy, Default)] #[derive(Debug, Clone, Copy, Default)]
struct Options { struct Options {

View file

@ -1,18 +1,10 @@
// Implementation of the set_color builtin. // Implementation of the set_color builtin.
use super::shared::{ use super::prelude::*;
builtin_print_help, builtin_unknown_option, io_streams_t, STATUS_CMD_ERROR, STATUS_CMD_OK,
STATUS_INVALID_ARGS,
};
use crate::color::RgbColor; use crate::color::RgbColor;
use crate::common::str2wcstring; use crate::common::str2wcstring;
use crate::curses::{self, Term}; use crate::curses::{self, Term};
use crate::ffi::parser_t;
use crate::output::{self, Outputter}; use crate::output::{self, Outputter};
use crate::wchar::{wstr, L};
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::wgettext_fmt;
use libc::c_int;
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
fn print_modifiers( fn print_modifiers(

View file

@ -1,26 +1,13 @@
use std::os::unix::prelude::OsStrExt; use std::os::unix::prelude::OsStrExt;
use crate::builtins::shared::{ use super::prelude::*;
builtin_missing_argument, builtin_print_help, builtin_unknown_option, io_streams_t,
BUILTIN_ERR_ARG_COUNT2, BUILTIN_ERR_COMBO2_EXCLUSIVE, BUILTIN_ERR_INVALID_SUBCMD,
BUILTIN_ERR_NOT_NUMBER, STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::common::{get_executable_path, str2wcstring}; use crate::common::{get_executable_path, str2wcstring};
use crate::ffi::{ use crate::ffi::{
get_job_control_mode, get_login, is_interactive_session, job_control_t, parser_t, get_job_control_mode, get_login, is_interactive_session, job_control_t, set_job_control_mode,
set_job_control_mode, Repin,
}; };
use crate::future_feature_flags::{self as features, feature_test}; use crate::future_feature_flags::{self as features, feature_test};
use crate::wchar::{wstr, L}; use crate::wutil::{waccess, wbasename, wdirname, wrealpath, Error};
use crate::wchar_ffi::{AsWstr, WCharFromFFI}; use libc::F_OK;
use crate::wgetopt::{
wgetopter_t, wopt, woption,
woption_argument_t::{no_argument, required_argument},
};
use crate::wutil::{
fish_wcstoi, sprintf, waccess, wbasename, wdirname, wgettext, wgettext_fmt, wrealpath, Error,
};
use libc::{c_int, F_OK};
use nix::errno::Errno; use nix::errno::Errno;
use nix::NixPath; use nix::NixPath;
use num_derive::FromPrimitive; use num_derive::FromPrimitive;

View file

@ -1,20 +1,7 @@
use crate::wcstringutil::fish_wcwidth_visible; use crate::wcstringutil::fish_wcwidth_visible;
// Forward some imports to make subcmd implementations easier // Forward some imports to make subcmd implementations easier
use crate::{ use super::prelude::*;
builtins::shared::{ use crate::ffi::separation_type_t;
builtin_missing_argument, builtin_print_error_trailer, builtin_print_help, io_streams_t,
Arguments, SplitBehavior, BUILTIN_ERR_ARG_COUNT0, BUILTIN_ERR_ARG_COUNT1,
BUILTIN_ERR_COMBO2, BUILTIN_ERR_INVALID_SUBCMD, BUILTIN_ERR_MISSING_SUBCMD,
BUILTIN_ERR_NOT_NUMBER, BUILTIN_ERR_TOO_MANY_ARGUMENTS, BUILTIN_ERR_UNKNOWN,
STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS,
},
ffi::{parser_t, separation_type_t},
wchar::{wstr, WString, L},
wchar_ext::{ToWString, WExt},
wgetopt::{wgetopter_t, wopt, woption, woption_argument_t::*, NONOPTION_CHAR_CODE},
wutil::{wgettext, wgettext_fmt},
};
use libc::c_int;
mod collect; mod collect;
mod escape; mod escape;

View file

@ -1,19 +1,12 @@
use libc::c_int; use super::prelude::*;
use crate::builtins::shared::{
builtin_print_error_trailer, io_streams_t, STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::common; use crate::common;
use crate::ffi::parser_t;
use crate::ffi::Repin;
use crate::wchar::prelude::*;
use crate::wchar_ffi::AsWstr;
mod test_expressions { mod test_expressions {
use super::*; use super::*;
use crate::wutil::{ use crate::wutil::{
file_id_for_path, fish_wcstol, fish_wcswidth, lwstat, waccess, wcstod::wcstod, wcstoi_opts, file_id_for_path, fish_wcswidth, lwstat, waccess, wcstod::wcstod, wcstoi_opts, wstat,
wstat, Error, Options, Error, Options,
}; };
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::collections::HashMap; use std::collections::HashMap;

View file

@ -1,8 +1,7 @@
use crate::builtins::shared::{io_streams_t, STATUS_CMD_OK, STATUS_INVALID_ARGS}; use crate::builtins::prelude::*;
use crate::builtins::test::test as builtin_test; use crate::builtins::test::test as builtin_test;
use crate::ffi::{make_null_io_streams_ffi, parser_t}; use crate::ffi::make_null_io_streams_ffi;
use crate::wchar::prelude::*;
fn run_one_test_test_mbracket(expected: i32, lst: &[&str], bracket: bool) -> bool { fn run_one_test_test_mbracket(expected: i32, lst: &[&str], bracket: bool) -> bool {
let parser: &mut parser_t = unsafe { &mut *parser_t::principal_parser_ffi() }; let parser: &mut parser_t = unsafe { &mut *parser_t::principal_parser_ffi() };

View file

@ -1,20 +1,11 @@
use libc::c_int;
use libc::isatty; use libc::isatty;
use libc::STDOUT_FILENO; use libc::STDOUT_FILENO;
use crate::builtins::shared::{ use super::prelude::*;
builtin_missing_argument, builtin_print_help, builtin_unknown_option, io_streams_t,
BUILTIN_ERR_COMBO, STATUS_CMD_ERROR, STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::ffi::parser_t;
use crate::ffi::Repin;
use crate::ffi::{builtin_exists, colorize_shell}; use crate::ffi::{builtin_exists, colorize_shell};
use crate::function; use crate::function;
use crate::path::{path_get_path, path_get_paths}; use crate::path::{path_get_path, path_get_paths};
use crate::wchar::prelude::*;
use crate::wchar_ffi::WCharFromFFI;
use crate::wchar_ffi::WCharToFFI;
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
#[derive(Default)] #[derive(Default)]
struct type_cmd_opts_t { struct type_cmd_opts_t {

View file

@ -1,15 +1,10 @@
use libc::{c_int, pid_t}; use libc::pid_t;
use crate::builtins::shared::{ use super::prelude::*;
builtin_missing_argument, builtin_print_help, builtin_unknown_option, io_streams_t, use crate::ffi::{job_t, parser_t, proc_wait_any};
STATUS_CMD_OK, STATUS_INVALID_ARGS,
};
use crate::ffi::{job_t, parser_t, proc_wait_any, Repin};
use crate::signal::SigChecker; use crate::signal::SigChecker;
use crate::wait_handle::{WaitHandleRef, WaitHandleStore}; use crate::wait_handle::{WaitHandleRef, WaitHandleStore};
use crate::wchar::{widestrs, wstr}; use crate::wutil;
use crate::wgetopt::{wgetopter_t, wopt, woption, woption_argument_t};
use crate::wutil::{self, fish_wcstoi, wgettext_fmt};
/// \return true if we can wait on a job. /// \return true if we can wait on a job.
fn can_wait_on_job(j: &cxx::SharedPtr<job_t>) -> bool { fn can_wait_on_job(j: &cxx::SharedPtr<job_t>) -> bool {