#NEWLINE# @ click . command ( ) #NEWLINE# @ click . option ( '--count' , default = 2 , callback = validate_count , help = 'A positive even number.' ) #NEWLINE# @ click . option ( '--foo' , help = 'A mysterious parameter.' ) #NEWLINE# @ click . option ( '--url' , help = 'A URL' , type = URL ( ) ) #NEWLINE# @ click . version_option ( ) #NEWLINE# def cli( count , foo , url ) : #NEWLINE# #INDENT# 'Validation.\n\n    This example validates parameters in different ways.  It does it\n    through callbacks, through a custom type as well as by validating\n    manually in the function.\n    ' #NEWLINE# if ( ( foo is not None ) and ( foo != 'wat' ) ) : #NEWLINE# #INDENT# raise click . BadParameter ( 'If a value is provided it needs to be the value "wat".' , param_hint = [ '--foo' ] ) #NEWLINE# #UNINDENT# click . echo ( ( 'count: %s' % count ) ) #NEWLINE# click . echo ( ( 'foo: %s' % foo ) ) #NEWLINE# click . echo ( ( 'url: %s' % repr ( url ) ) )