diff --git a/src/cmd/utils.go b/src/cmd/utils.go index 845ec41..ce131f2 100644 --- a/src/cmd/utils.go +++ b/src/cmd/utils.go @@ -67,7 +67,16 @@ func showManual(manual string) error { manBinary, err := exec.LookPath("man") if err != nil { if errors.Is(err, exec.ErrNotFound) { - return errors.New("man(1) not found") + fmt.Print(`toolbox - Tool for containerized command line environments on Linux + +Common commands are: +create Create a new toolbox container +enter Enter an existing toolbox container +list List all existing toolbox containers and images + +Go to https://github.com/containers/toolbox for further information. +`) + return nil } return errors.New("failed to lookup man(1)") diff --git a/test/system/002-help.bats b/test/system/002-help.bats index cca3da4..91870b0 100644 --- a/test/system/002-help.bats +++ b/test/system/002-help.bats @@ -15,6 +15,22 @@ setup() { assert_output --partial "toolbox - Tool for containerized command line environments on Linux" } +@test "help: Run command 'help' with no man present" { + if hash man 2>/dev/null; then + skip "Test works only if man is not in PATH" + fi + + run $TOOLBOX help + + assert_success + assert_line --index 0 "toolbox - Tool for containerized command line environments on Linux" + assert_line --index 1 "Common commands are:" + assert_line --index 2 "create Create a new toolbox container" + assert_line --index 3 "enter Enter an existing toolbox container" + assert_line --index 4 "list List all existing toolbox containers and images" + assert_line --index 5 "Go to https://github.com/containers/toolbox for further information." +} + @test "help: Use flag '--help' (it should show usage screen)" { run $TOOLBOX --help