Skip to content

Commit

Permalink
Treat command names as case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
np committed Jan 16, 2015
1 parent 6eb2b3f commit efe3e74
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ mainArgs _ = error $ unlines ["Unexpected arguments."
,""
,"List of supported commands:"
,""
,"Command names are case-insensitive: SHA256 is equivalent to sha256."
,""
,"# ADDRESSES"
,"hx addr"
,"hx validaddr [<ADDRESS>]"
Expand Down Expand Up @@ -751,4 +753,6 @@ mainArgs _ = error $ unlines ["Unexpected arguments."
]

main :: IO ()
main = mainArgs . map B8.pack =<< getArgs
main = mainArgs . toLowerFirst . map B8.pack =<< getArgs
where toLowerFirst [] = []
toLowerFirst (x:xs) = B8.map toLower x : xs
42 changes: 42 additions & 0 deletions tests/SHA256.t/TESTRECIPE
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

testname=SHA256.t
command=hx
args=( SHA256 )
exit_code=0
stdin_file=stdin
stdout_file=stdout
stderr_file=/dev/null
sources=( )
products=( )

# Environment variables:
env_vars=( )

setup(){
: Perform here actions to be run before the tested program
}

munge(){
: Munge here the results of the tested program to ease the check
}

check(){
check_exit_code &&
check_stderr &&
check_stdout &&
check_products &&
: Perform here extra checks on the tested program
}

explain(){
explain_exit_code
explain_stdout
explain_stderr
explain_products
: Explain here more potential differences
}

teardown(){
: Undo here the actions of setup
}
1 change: 1 addition & 0 deletions tests/SHA256.t/stdin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
1 change: 1 addition & 0 deletions tests/SHA256.t/stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b867db875479bcc0287352cdaa4a1755689b8338777d0915e9acd9f6edbc96cb

0 comments on commit efe3e74

Please sign in to comment.