mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Rearrange functions in tee
This commit is contained in:
parent
af4092124b
commit
7e260558b8
1 changed files with 9 additions and 9 deletions
18
tee/tee.rs
18
tee/tee.rs
|
@ -70,15 +70,6 @@ fn options(args: &[~str]) -> Result<Options, ~str> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open(path: &Path, append: bool) -> ~Writer {
|
|
||||||
if *path == Path::new("-") {
|
|
||||||
~stdout() as ~Writer
|
|
||||||
} else {
|
|
||||||
let mode = if append { Append } else { Truncate };
|
|
||||||
~File::open_mode(path, mode, Write) as ~Writer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn exec(options: Options) -> Result<int, ~str> {
|
fn exec(options: Options) -> Result<int, ~str> {
|
||||||
match options.print_and_exit {
|
match options.print_and_exit {
|
||||||
Some(text) => {
|
Some(text) => {
|
||||||
|
@ -108,6 +99,15 @@ fn tee(options: Options) -> Result<int, ~str> {
|
||||||
})).map_err(|err| err.desc.to_owned())
|
})).map_err(|err| err.desc.to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn open(path: &Path, append: bool) -> ~Writer {
|
||||||
|
if *path == Path::new("-") {
|
||||||
|
~stdout() as ~Writer
|
||||||
|
} else {
|
||||||
|
let mode = if append { Append } else { Truncate };
|
||||||
|
~File::open_mode(path, mode, Write) as ~Writer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn warn(message: &str) {
|
fn warn(message: &str) {
|
||||||
error!("{}: {}", args()[0], message);
|
error!("{}: {}", args()[0], message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue