Created
September 8, 2018 00:47
-
-
Save LuckyTeng/6ecafa872e89ac9f01a244c2121c4b26 to your computer and use it in GitHub Desktop.
check_verbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enableDelayedExpansion | |
if not defined bin ( | |
:: set bin to current directory | |
set bin=%~dp0 | |
) | |
echo current dir %bin% | |
set verbs=;open;delete;version; | |
echo checking verb... | |
call:checkMatch "%verbs%" %* || ( | |
echo. | |
echo verb is ok | |
exit /b 0 | |
) | |
echo invalid verb, ava is open, delete, version | |
exit /b 1 | |
:checkMatch | |
set verbs=%~1 | |
set verb="" | |
shift | |
:loop | |
if "%~1"=="" ( goto:done ) | |
set arg=%~1 | |
shift | |
echo arg is %arg% | |
if "%arg:~0,1%"=="-" ( goto:loop ) | |
if !verb!=="" if "!verbs:;%arg%;=!" neq "!verbs!" ( | |
echo find verb !arg! | |
set verb=!arg! | |
goto:loop | |
) | |
:done | |
if !verb! neq "" exit /b 1 | |
exit /b 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment