Skip to content

Commit

Permalink
Update to new CLI help output
Browse files Browse the repository at this point in the history
  • Loading branch information
fsoikin committed Sep 1, 2024
1 parent fadbcc8 commit 9a32078
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 29 deletions.
39 changes: 16 additions & 23 deletions test-fixtures/init/subpackage/conflicting-flags.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
Invalid option `--subpackage'

Usage: index.dev.js (COMMAND | (-v|--version))
PureScript package manager and build tool
Usage: index.dev.js init [--migrate] [--monochrome|--no-color] [--offline] [-q|--quiet] [-v|--verbose] ([--subpackage ARG] | [--name ARG]) [--package-set ARG] [--use-solver]
Initialise a new project

Available options:
--migrate Migrate the spago.yaml file to the latest format
--monochrome,--no-color Force logging without ANSI color escape sequences
--offline Do not attempt to use the network. Warning: this will
fail if you don't have the necessary dependencies
already cached
-q,--quiet Suppress all spago logging
-v,--verbose Enable additional debug logging, e.g. printing `purs`
commands
--subpackage ARG Name of a subpackage to initialize within the current
workspace
--name ARG Optional package name to be used for the new project
--package-set ARG Optional package set version to be used instead of
the latest one
--use-solver Use the solver instead of package sets
-h,--help Show this help text
-v,--version Show the current version

Available commands:
init Initialise a new project
fetch Downloads all of the project's dependencies
install Compile the project's dependencies
uninstall Remove dependencies from a package
build Compile the project
run Run the project
test Test the project
bundle Bundle the project in a single file
sources List all the source paths (globs) for the
dependencies of the project
repl Start a REPL
publish Publish a package
upgrade Upgrade to the latest package set, or to the latest
versions of Registry packages
docs Generate docs for the project and its dependencies
registry Commands to interact with the Registry
ls List packages or dependencies
graph Generate a graph of modules or dependencies
11 changes: 7 additions & 4 deletions test/Spago/Cli.purs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ spec = Spec.around withTempDir do
{ stdoutFile: stdout
, stderrFile: stderr
, result
, sanitize:
String.trim
>>> Regex.replace progNameRegex "Usage: index.dev.js"
>>> Regex.replace optionsLineRegex " $1"
, sanitize: sanitizeCliHelpOutput
}

sanitizeCliHelpOutput :: String -> String
sanitizeCliHelpOutput =
String.trim
>>> Regex.replace progNameRegex "Usage: index.dev.js"
>>> Regex.replace optionsLineRegex " $1"
where
-- On Windows progname has the full path like
-- "Usage: C:\whatever\index.dev.js", but on Unix
-- it's just "Usage: index.dev.js"
Expand Down
4 changes: 2 additions & 2 deletions test/Spago/InitSubpackage.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module Test.Spago.InitSubpackage where

import Test.Prelude

import Data.String as String
import Data.String.Regex as Regex
import Data.String.Regex.Flags as RF
import Node.Path as Path
import Spago.FS as FS
import Test.Spago.Cli (sanitizeCliHelpOutput)
import Test.Spec (SpecT)
import Test.Spec as Spec

Expand Down Expand Up @@ -54,7 +54,7 @@ spec =
, stderrFile: Just fixture
, result
, sanitize:
String.trim
sanitizeCliHelpOutput
>>> withForwardSlashes
>>> Regex.replace versionsRegex "Found PureScript a.b.c, will use package set x.y.z"
}
Expand Down

0 comments on commit 9a32078

Please sign in to comment.