Warn about cp/mv/ln with a single argument. Fixes #1080.

This commit is contained in:
Vidar Holen 2018-01-13 16:39:59 -08:00
parent 31d6b063d9
commit 2d5ed23ca1
3 changed files with 39 additions and 0 deletions

View file

@ -112,6 +112,7 @@ getFlagsUntil stopCondition (T_SimpleCommand _ _ (_:args)) =
getFlagsUntil _ _ = error "Internal shellcheck error, please report! (getFlags on non-command)"
-- Get all flags in a GNU way, up until --
getAllFlags :: Token -> [(Token, String)]
getAllFlags = getFlagsUntil (== "--")
-- Get all flags in a BSD way, up until first non-flag argument or --
getLeadingFlags = getFlagsUntil (\x -> x == "--" || (not $ "-" `isPrefixOf` x))