Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[env]
PROJECT_NAME = "posixutils-rs"
5 changes: 3 additions & 2 deletions display/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ edition.workspace = true
rust-version.workspace = true

[dependencies]
plib = { path = "../plib" }
clap.workspace = true
gettext-rs.workspace = true

[dev-dependencies]
plib = { path = "../plib" }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this remains as a dev-dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests.

[lints]
workspace = true

Expand All @@ -22,4 +24,3 @@ path = "./echo.rs"
[[bin]]
name = "printf"
path = "./printf.rs"

5 changes: 2 additions & 3 deletions display/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
//

use gettextrs::{bind_textdomain_codeset, setlocale, textdomain, LocaleCategory};
use plib::PROJECT_NAME;
use std::io::{self, Write};

fn translate_str(skip_nl: bool, s: &str) -> String {
Expand Down Expand Up @@ -73,8 +72,8 @@ fn translate_str(skip_nl: bool, s: &str) -> String {

fn main() -> Result<(), Box<dyn std::error::Error>> {
setlocale(LocaleCategory::LcAll, "");
textdomain(PROJECT_NAME)?;
bind_textdomain_codeset(PROJECT_NAME, "UTF-8")?;
textdomain(env!("PROJECT_NAME"))?;
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;

let mut args: Vec<String> = std::env::args().collect();
args.remove(0);
Expand Down
5 changes: 2 additions & 3 deletions display/printf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//

use gettextrs::{bind_textdomain_codeset, gettext, setlocale, textdomain, LocaleCategory};
use plib::PROJECT_NAME;
use std::io::{self, Write};

// the following structure is a printf format conversion specifier
Expand Down Expand Up @@ -322,8 +321,8 @@ fn do_printf(format: &str, args: &[String]) -> io::Result<()> {

fn main() -> Result<(), Box<dyn std::error::Error>> {
setlocale(LocaleCategory::LcAll, "");
textdomain(PROJECT_NAME)?;
bind_textdomain_codeset(PROJECT_NAME, "UTF-8")?;
textdomain(env!("PROJECT_NAME"))?;
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;

let args: Vec<String> = std::env::args().collect();

Expand Down
2 changes: 1 addition & 1 deletion display/tests/echo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: MIT
//

use plib::{run_test, TestPlan};
use plib::testing::{run_test, TestPlan};

fn echo_test(args: &[&str], expected_output: &str) {
let str_args: Vec<String> = args.iter().map(|s| String::from(*s)).collect();
Expand Down
2 changes: 1 addition & 1 deletion display/tests/printf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: MIT
//

use plib::{run_test, TestPlan};
use plib::testing::{run_test, TestPlan};

#[test]
fn test_basic_string_output() {
Expand Down