Rearrange functions in tee

This commit is contained in:
pabzdzdzwiagief 2013-12-28 02:23:13 +01:00
parent af4092124b
commit 7e260558b8

View file

@ -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> {
match options.print_and_exit {
Some(text) => {
@ -108,6 +99,15 @@ fn tee(options: Options) -> Result<int, ~str> {
})).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) {
error!("{}: {}", args()[0], message);
}