# Verify that specifying unexpected options or arguments results in an error.

# First using the legacy, now deprecated, long options to specify a
# subcommand.

# First with the history function.
history --search --merge
history --clear --contains
history --merge -t
history --save xyz

# Now with the history builtin.
builtin history --save --prefix
builtin history --clear --show-time
builtin history --merge xyz
builtin history --clear abc def

# Put a blank line in the stderr output to separate the above sequence from
# the following sequence of tests.
echo >&2

# Now using the preferred subcommand form. Note that we support flags before
# or after the subcommand name so test both variants.

# First with the history function.
history clear --contains
history merge -t
history save xyz
history --prefix clear
history --show-time merge
echo >&2

# Now with the history builtin.
builtin history --search --merge
builtin history save --prefix
builtin history clear --show-time
builtin history merge xyz
builtin history clear abc def
builtin history --contains save
builtin history -t merge

# Now do a history command that should succeed so we exit with a zero,
# success, status.
builtin history save
