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: 1 addition & 1 deletion src/uu/sed/src/main.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
uucore::bin!(uu_free);
uucore::bin!(uu_sed);
11 changes: 4 additions & 7 deletions src/uu/sed/src/sed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@
// file that was distributed with this source code.

use clap::{arg, Command};
use std::{
fs,
io::{self, BufRead, Write},
process,
};
use uucore::{error::UResult, format_usage, help_about, help_usage};
use uucore::{error::UResult, format_usage};

const ABOUT: &str = "Stream editor for filtering and transforming text";
const USAGE: &str = "sed [-n] script [file...]";

#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().try_get_matches_from(args)?;
// TODO remove underscore prefix when var is used
let _matches = uu_app().try_get_matches_from(args)?;
// TODO
Ok(())
}

#[allow(clippy::cognitive_complexity)]
pub fn uu_app() -> Command {
Command::new(uucore::util_name())
.about(ABOUT)
Expand Down
6 changes: 1 addition & 5 deletions tests/by-util/test_sed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore (words) symdir somefakedir

use pretty_assertions::assert_eq;
use regex::Regex;

use crate::common::util::TestScenario;

Expand All @@ -16,5 +12,5 @@ fn test_invalid_arg() {

#[test]
fn test_sed() {
let result = new_ucmd!().succeeds();
new_ucmd!().succeeds();
}
24 changes: 12 additions & 12 deletions tests/common/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

//spell-checker: ignore (linux) rlimit prlimit coreutil ggroups uchild uncaptured scmd SHLVL canonicalized

#![allow(dead_code)]
#![allow(dead_code, unexpected_cfgs)]

use pretty_assertions::assert_eq;
#[cfg(any(target_os = "linux", target_os = "android"))]
Expand All @@ -25,7 +25,7 @@ use std::os::unix::process::ExitStatusExt;
#[cfg(windows)]
use std::os::windows::fs::{symlink_dir, symlink_file};
#[cfg(windows)]
use std::path::MAIN_SEPARATOR;
use std::path::MAIN_SEPARATOR_STR;
use std::path::{Path, PathBuf};
use std::process::{Child, Command, ExitStatus, Output, Stdio};
use std::rc::Rc;
Expand Down Expand Up @@ -171,7 +171,7 @@ impl CmdResult {

/// Assert `stdout` as bytes with a predicate function returning a `bool`.
#[track_caller]
pub fn stdout_check<'a, F>(&'a self, predicate: F) -> &Self
pub fn stdout_check<'a, F>(&'a self, predicate: F) -> &'a Self
where
F: Fn(&'a [u8]) -> bool,
{
Expand All @@ -186,7 +186,7 @@ impl CmdResult {

/// Assert `stdout` as `&str` with a predicate function returning a `bool`.
#[track_caller]
pub fn stdout_str_check<'a, F>(&'a self, predicate: F) -> &Self
pub fn stdout_str_check<'a, F>(&'a self, predicate: F) -> &'a Self
where
F: Fn(&'a str) -> bool,
{
Expand All @@ -201,7 +201,7 @@ impl CmdResult {

/// Assert `stderr` as bytes with a predicate function returning a `bool`.
#[track_caller]
pub fn stderr_check<'a, F>(&'a self, predicate: F) -> &Self
pub fn stderr_check<'a, F>(&'a self, predicate: F) -> &'a Self
where
F: Fn(&'a [u8]) -> bool,
{
Expand All @@ -216,7 +216,7 @@ impl CmdResult {

/// Assert `stderr` as `&str` with a predicate function returning a `bool`.
#[track_caller]
pub fn stderr_str_check<'a, F>(&'a self, predicate: F) -> &Self
pub fn stderr_str_check<'a, F>(&'a self, predicate: F) -> &'a Self
where
F: Fn(&'a str) -> bool,
{
Expand Down Expand Up @@ -993,7 +993,7 @@ impl AtPath {

pub fn relative_symlink_file(&self, original: &str, link: &str) {
#[cfg(windows)]
let original = original.replace('/', &MAIN_SEPARATOR.to_string());
let original = original.replace('/', MAIN_SEPARATOR_STR);
log_info(
"symlink",
format!("{},{}", &original, &self.plus_as_string(link)),
Expand All @@ -1015,7 +1015,7 @@ impl AtPath {

pub fn relative_symlink_dir(&self, original: &str, link: &str) {
#[cfg(windows)]
let original = original.replace('/', &MAIN_SEPARATOR.to_string());
let original = original.replace('/', MAIN_SEPARATOR_STR);
log_info(
"symlink",
format!("{},{}", &original, &self.plus_as_string(link)),
Expand Down Expand Up @@ -1401,12 +1401,12 @@ impl UCommand {
///
/// These __defaults__ are:
/// * `bin_path`: Depending on the platform and os, the native shell (unix -> `/bin/sh` etc.).
/// This default also requires to set the first argument to `-c` on unix (`/C` on windows) if
/// this argument wasn't specified explicitly by the user.
/// This default also requires to set the first argument to `-c` on unix (`/C` on windows) if
/// this argument wasn't specified explicitly by the user.
/// * `util_name`: `None`. If neither `bin_path` nor `util_name` were given the arguments are
/// run in a shell (See `bin_path` above).
/// run in a shell (See `bin_path` above).
/// * `temp_dir`: If `current_dir` was not set, a new temporary directory will be created in
/// which this command will be run and `current_dir` will be set to this `temp_dir`.
/// which this command will be run and `current_dir` will be set to this `temp_dir`.
/// * `current_dir`: The temporary directory given by `temp_dir`.
/// * `timeout`: `30 seconds`
/// * `stdin`: `Stdio::null()`
Expand Down