Skip to content
Snippets Groups Projects
Commit 8dae3870 authored by Michael Aaron Murphy's avatar Michael Aaron Murphy
Browse files

Merge branch 'master' of https://github.com/redox-os/ion

parents b07029d3 99669da4
Branches
No related tags found
No related merge requests found
......@@ -357,9 +357,8 @@ fn builtin_echo(args: &[&str], _: &mut Shell) -> i32 {
}
fn builtin_test(args: &[&str], _: &mut Shell) -> i32 {
if check_help(args, MAN_TEST) {
return SUCCESS;
}
// Do not use `check_help` for the `test` builtin. The
// `test` builtin contains a "-h" option.
match test(args) {
Ok(true) => SUCCESS,
Ok(false) => FAILURE,
......
......@@ -3,6 +3,7 @@ use std::fs;
use std::os::unix::fs::{FileTypeExt, MetadataExt, PermissionsExt};
use std::path::Path;
use std::time::SystemTime;
use super::man_pages::{print_man, MAN_TEST};
pub(crate) fn test(args: &[&str]) -> Result<bool, String> {
let arguments = &args[1..];
......@@ -23,6 +24,12 @@ fn evaluate_arguments(arguments: &[&str]) -> Result<bool, String> {
})
})
}
Some(&s) if s == "--help" => {
// "--help" only makes sense if it is the first option. Only look for it
// in the first position.
print_man(MAN_TEST);
Ok(true)
}
Some(arg) => {
// If there is no operator, check if the first argument is non-zero
arguments
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment