From 9a3207807a64656cbe54ddd4559882858877350c Mon Sep 17 00:00:00 2001 From: Fyodor Soikin Date: Sat, 31 Aug 2024 22:57:52 -0400 Subject: [PATCH] Update to new CLI help output --- .../init/subpackage/conflicting-flags.txt | 39 ++++++++----------- test/Spago/Cli.purs | 11 ++++-- test/Spago/InitSubpackage.purs | 4 +- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/test-fixtures/init/subpackage/conflicting-flags.txt b/test-fixtures/init/subpackage/conflicting-flags.txt index b21b543f3..47c382272 100644 --- a/test-fixtures/init/subpackage/conflicting-flags.txt +++ b/test-fixtures/init/subpackage/conflicting-flags.txt @@ -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 diff --git a/test/Spago/Cli.purs b/test/Spago/Cli.purs index 9570e7440..9b9f2c6ae 100644 --- a/test/Spago/Cli.purs +++ b/test/Spago/Cli.purs @@ -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" diff --git a/test/Spago/InitSubpackage.purs b/test/Spago/InitSubpackage.purs index 2a0ea657c..567b4dae1 100644 --- a/test/Spago/InitSubpackage.purs +++ b/test/Spago/InitSubpackage.purs @@ -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 @@ -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" }