Rename printf crate to fish-printf

Preparing to publish to crates.io
This commit is contained in:
ridiculousfish 2024-06-09 12:29:09 -07:00
parent 56ea456ca3
commit 838ff86ae7
16 changed files with 32 additions and 32 deletions

18
Cargo.lock generated
View File

@ -91,6 +91,7 @@ dependencies = [
"cc",
"errno",
"fast-float",
"fish-printf",
"lazy_static",
"libc",
"lru",
@ -98,7 +99,6 @@ dependencies = [
"num-traits",
"once_cell",
"pcre2",
"printf",
"rand",
"rand_pcg",
"rsconf",
@ -107,6 +107,14 @@ dependencies = [
"widestring",
]
[[package]]
name = "fish-printf"
version = "0.1.0"
dependencies = [
"libc",
"widestring",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -323,14 +331,6 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "printf"
version = "0.1.0"
dependencies = [
"libc",
"widestring",
]
[[package]]
name = "proc-macro2"
version = "1.0.85"

View File

@ -34,7 +34,7 @@ lru = "0.12.3"
nix = { version = "0.29.0", default-features = false, features = ["inotify", "resource", "fs"] }
num-traits = "0.2.19"
once_cell = "1.19.0"
printf = { path = "./printf" }
fish-printf = { path = "./printf" }
rand = { version = "0.8.5", features = ["small_rng"] }
widestring = "1.1.0"
terminfo = "0.9.0"

View File

@ -1,5 +1,5 @@
[package]
name = "printf"
name = "fish-printf"
edition = "2021"
version = "0.1.0"
description = "printf implementation, based on musl"

View File

@ -17,8 +17,8 @@ use crate::{
wchar::{wstr, WString, L},
wutil::{fish_wcstoi, wgettext_fmt},
};
use fish_printf::sprintf;
use libc::c_int;
use printf::sprintf;
use std::num::NonZeroU32;
use std::sync::atomic::Ordering;

View File

@ -57,7 +57,7 @@ use crate::wutil::{
wcstoi::{wcstoi_partial, Options as WcstoiOpts},
wstr_offset_in,
};
use printf::{sprintf_locale, ToArg};
use fish_printf::{sprintf_locale, ToArg};
/// Return true if `c` is an octal digit.
fn is_octal_digit(c: char) -> bool {

View File

@ -1,5 +1,5 @@
use fish_printf::sprintf;
use pcre2::utf32::{Captures, Regex, RegexBuilder};
use printf::sprintf;
use std::collections::HashMap;
use super::*;

View File

@ -15,8 +15,8 @@ use crate::{
util::wcsfilecmp,
};
use bitflags::bitflags;
use fish_printf::sprintf;
use once_cell::sync::Lazy;
use printf::sprintf;
use crate::{
abbrs::with_abbrs,

View File

@ -41,8 +41,8 @@ impl ToWString for MaybeJobId {
}
}
impl<'a> printf::ToArg<'a> for MaybeJobId {
fn to_arg(self) -> printf::Arg<'a> {
impl<'a> fish_printf::ToArg<'a> for MaybeJobId {
fn to_arg(self) -> fish_printf::Arg<'a> {
self.as_num().to_arg()
}
}

View File

@ -375,9 +375,9 @@ impl std::fmt::Display for Key {
}
}
impl printf::ToArg<'static> for Key {
fn to_arg(self) -> printf::Arg<'static> {
printf::Arg::WString(self.into())
impl fish_printf::ToArg<'static> for Key {
fn to_arg(self) -> fish_printf::Arg<'static> {
fish_printf::Arg::WString(self.into())
}
}

View File

@ -1,5 +1,5 @@
/// Support for the "current locale."
pub use printf::locale::{Locale, C_LOCALE};
pub use fish_printf::locale::{Locale, C_LOCALE};
use std::sync::Mutex;
/// Lock guarding libc `setlocale()` or `localeconv()` calls to avoid races.

View File

@ -235,9 +235,9 @@ impl ParseKeyword {
}
}
impl printf::ToArg<'static> for ParseKeyword {
fn to_arg(self) -> printf::Arg<'static> {
printf::Arg::WStr(self.to_wstr())
impl fish_printf::ToArg<'static> for ParseKeyword {
fn to_arg(self) -> fish_printf::Arg<'static> {
fish_printf::Arg::WStr(self.to_wstr())
}
}

View File

@ -31,8 +31,8 @@ use crate::wait_handle::WaitHandleStore;
use crate::wchar::{wstr, WString, L};
use crate::wutil::{perror, wgettext, wgettext_fmt};
use crate::{function, FLOG};
use fish_printf::sprintf;
use libc::c_int;
use printf::sprintf;
use std::cell::{Ref, RefCell, RefMut};
use std::ffi::{CStr, OsStr};
use std::os::fd::{AsRawFd, OwnedFd, RawFd};

View File

@ -25,6 +25,7 @@ use crate::wait_handle::{InternalJobId, WaitHandle, WaitHandleRef, WaitHandleSto
use crate::wchar::{wstr, WString, L};
use crate::wchar_ext::ToWString;
use crate::wutil::{perror, wbasename, wgettext, wperror};
use fish_printf::sprintf;
use libc::{
EBADF, EINVAL, ENOTTY, EPERM, EXIT_SUCCESS, SIGABRT, SIGBUS, SIGCONT, SIGFPE, SIGHUP, SIGILL,
SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSYS, SIGTTOU, SIG_DFL, SIG_IGN, STDIN_FILENO,
@ -32,7 +33,6 @@ use libc::{
WUNTRACED, _SC_CLK_TCK,
};
use once_cell::sync::Lazy;
use printf::sprintf;
use std::cell::{Cell, Ref, RefCell, RefMut};
use std::fs;
use std::io::{Read, Write};

View File

@ -191,10 +191,10 @@ impl From<TokenizerError> for &'static wstr {
}
}
impl printf::ToArg<'static> for TokenizerError {
fn to_arg(self) -> printf::Arg<'static> {
impl fish_printf::ToArg<'static> for TokenizerError {
fn to_arg(self) -> fish_printf::Arg<'static> {
let msg: &'static wstr = self.into();
printf::Arg::WStr(msg)
fish_printf::Arg::WStr(msg)
}
}

View File

@ -26,8 +26,8 @@ use std::fs::{self, canonicalize};
use std::io::{self, Write};
use std::os::unix::prelude::*;
extern crate printf as extern_printf;
pub use extern_printf::sprintf;
extern crate fish_printf;
pub use fish_printf::sprintf;
pub use wcstoi::*;

View File

@ -1,5 +1,5 @@
// Re-export sprintf macro.
pub use printf::sprintf;
pub use fish_printf::sprintf;
#[cfg(test)]
mod tests {