mirror of https://github.com/zachjs/sv2v.git
remove long-deprecated CLI flag aliases
This commit is contained in:
parent
1c74178417
commit
a29564459b
|
|
@ -1,3 +1,10 @@
|
|||
## Unreleased
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
* Removed deprecated CLI flags `-d`/`-e`/`-i`, which have been aliased to
|
||||
`-D`/`-E`/`-I` with a warning since late 2019
|
||||
|
||||
## v0.0.11
|
||||
|
||||
### New Features
|
||||
|
|
|
|||
28
src/Job.hs
28
src/Job.hs
|
|
@ -17,7 +17,6 @@ import qualified Paths_sv2v (version)
|
|||
import System.IO (stderr, hPutStr)
|
||||
import System.Console.CmdArgs
|
||||
import System.Directory (doesDirectoryExist)
|
||||
import System.Environment (getArgs, withArgs)
|
||||
import System.Exit (exitFailure)
|
||||
|
||||
data Exclude
|
||||
|
|
@ -125,32 +124,9 @@ parseWrite w | otherwise = do
|
|||
matches :: String -> String -> Bool
|
||||
matches = isPrefixOf . map toLower
|
||||
|
||||
type DeprecationPhase = [String] -> IO [String]
|
||||
|
||||
flagRename :: String -> String -> DeprecationPhase
|
||||
flagRename before after strs = do
|
||||
let strs' = map rename strs
|
||||
if strs == strs'
|
||||
then return strs
|
||||
else do
|
||||
hPutStr stderr $ "Deprecation warning: " ++ before ++
|
||||
" has been renamed to " ++ after ++ "\n"
|
||||
return strs'
|
||||
where
|
||||
rename :: String -> String
|
||||
rename arg =
|
||||
if before == take (length before) arg
|
||||
then after ++ drop (length before) arg
|
||||
else arg
|
||||
|
||||
readJob :: IO Job
|
||||
readJob = do
|
||||
strs <- getArgs
|
||||
strs' <- return strs
|
||||
>>= flagRename "-i" "-I"
|
||||
>>= flagRename "-d" "-D"
|
||||
>>= flagRename "-e" "-E"
|
||||
withArgs strs' $ cmdArgs defaultJob
|
||||
readJob =
|
||||
cmdArgs defaultJob
|
||||
>>= setWrite . setSuccinct
|
||||
|
||||
setWrite :: Job -> IO Job
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@ NO_FILES_WARNING="Warning: No input files specified (try \`sv2v --help\`)"
|
|||
PACKAGE_WARNING="Warning: Source includes packages but no modules. Please convert packages alongside the modules that use them."
|
||||
INTERFACE_WARNING="Warning: Source includes an interface but output is empty because there is no top-level module which has no ports which are interfaces."
|
||||
PORT_CONN_ATTR_WARNING="attr.sv:6:11: Warning: Ignored port connection attributes (* foo *)(* bar *)."
|
||||
DEPRECATED_D_WARNING="Deprecation warning: -d has been renamed to -D"
|
||||
DEPRECATED_E_WARNING="Deprecation warning: -e has been renamed to -E"
|
||||
DEPRECATED_I_WARNING="Deprecation warning: -i has been renamed to -I"
|
||||
|
||||
test_default() {
|
||||
runAndCapture interface.sv module.sv package.sv
|
||||
|
|
@ -71,27 +68,6 @@ test_only_localparam_verbose() {
|
|||
assertNull "stderr should be empty" "$stderr"
|
||||
}
|
||||
|
||||
test_deprecated_d() {
|
||||
runAndCapture -d FOO -v localparam.sv
|
||||
assertTrue "conversion should succeed" $result
|
||||
assertNotNull "stdout should not be empty" "$stdout"
|
||||
assertEquals "stderr should have warning" "$DEPRECATED_D_WARNING" "$stderr"
|
||||
}
|
||||
|
||||
test_deprecated_e() {
|
||||
runAndCapture -e assert -v localparam.sv
|
||||
assertTrue "conversion should succeed" $result
|
||||
assertNotNull "stdout should not be empty" "$stdout"
|
||||
assertEquals "stderr should have warning" "$DEPRECATED_E_WARNING" "$stderr"
|
||||
}
|
||||
|
||||
test_deprecated_i() {
|
||||
runAndCapture -i. -v localparam.sv
|
||||
assertTrue "conversion should succeed" $result
|
||||
assertNotNull "stdout should not be empty" "$stdout"
|
||||
assertEquals "stderr should have warning" "$DEPRECATED_I_WARNING" "$stderr"
|
||||
}
|
||||
|
||||
source ../lib/functions.sh
|
||||
|
||||
. shunit2
|
||||
|
|
|
|||
Loading…
Reference in New Issue