mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
Improve errors from the option parser in daml2js (#6362)
fixes #6353 fixes #6352 This fixes the program name to refer to `daml codegen js` and changes the behavior to show help if the parser fails. Putting things together running `daml codegen js` without arguments now looks as follows: ``` Missing: DAR-FILES -o DIR Usage: daml codegen js DAR-FILES -o DIR [-s SCOPE] Generate TypeScript bindings from a DAR Available options: DAR-FILES DAR files to generate TypeScript bindings for -o DIR Output directory for the generated packages -s SCOPE The NPM scope name for the generated packages; defaults to daml.js -h,--help Show this help text ``` changelog_begin changelog_end
This commit is contained in:
parent
d93b7b2513
commit
03d3115a00
@ -30,6 +30,7 @@ import Data.Maybe
|
||||
import Data.Bifoldable
|
||||
import Options.Applicative
|
||||
import System.Directory
|
||||
import System.Environment
|
||||
import System.FilePath hiding ((<.>))
|
||||
import System.Process
|
||||
import System.Exit
|
||||
@ -119,8 +120,8 @@ mergePackageMap ps = foldM merge Map.empty ps
|
||||
|
||||
-- Write packages for all the DALFs in all the DARs.
|
||||
main :: IO ()
|
||||
main = do
|
||||
opts@Options{..} <- execParser optionsParserInfo
|
||||
main = withProgName "daml codegen js" $ do
|
||||
opts@Options{..} <- customExecParser (prefs showHelpOnError) optionsParserInfo
|
||||
sdkVersionOrErr <- DATypes.parseVersion . T.pack . fromMaybe "0.0.0" <$> getSdkVersionMaybe
|
||||
sdkVersion <- case sdkVersionOrErr of
|
||||
Left _ -> fail "Invalid SDK version"
|
||||
|
Loading…
Reference in New Issue
Block a user