Skip to content

Commit

Permalink
Merge branch 'main' into loop-invariant-code-motion
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz authored Dec 3, 2024
2 parents 7155464 + 97c29fb commit bf71187
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/Commands/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ init opts = do
when isInteractive (renderStdOutLn @Text "you are all set")
where
isInteractive :: Bool
isInteractive = not (opts ^. initOptionsNonInteractive) && not (opts ^. initOptionsBasic)
isInteractive = opts ^. initOptionsInteractive

checkNotInProject :: forall r. (Members '[EmbedIO, App] r) => Sem r ()
checkNotInProject =
Expand Down
12 changes: 6 additions & 6 deletions app/Commands/Init/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Commands.Init.Options where
import CommonOptions

data InitOptions = InitOptions
{ _initOptionsNonInteractive :: Bool,
{ _initOptionsInteractive :: Bool,
_initOptionsBasic :: Bool
}
deriving stock (Data)
Expand All @@ -12,16 +12,16 @@ makeLenses ''InitOptions

parseInitOptions :: Parser InitOptions
parseInitOptions = do
_initOptionsNonInteractive <-
_initOptionsInteractive <-
switch
( long "non-interactive"
<> short 'n'
<> help "Run non-interactively. Generates a default Package.juvix"
( long "interactive"
<> short 'i'
<> help "Run interactively"
)
_initOptionsBasic <-
switch
( long "basic"
<> short 'b'
<> help "Run non-interactively. Generates a basic Package.juvix that does not depend on the standard library"
<> help "Generate a basic Package.juvix that does not depend on the standard library"
)
pure InitOptions {..}
5 changes: 2 additions & 3 deletions tests/smoke/Commands/format.smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ tests:
temp=$(mktemp -d)
trap 'rm -rf -- "$temp"' EXIT
pushd $temp > /dev/null
juvix init -n
juvix init
popd > /dev/null
cp positive/Format.juvix $temp
mkdir $temp/sub
pushd $temp/sub > /dev/null
juvix init -n
juvix init
popd > /dev/null
cp positive/Format.juvix $temp/sub
juvix format $temp
Expand Down Expand Up @@ -364,4 +364,3 @@ tests:
stderr:
contains: juvix format error
exit-status: 1

10 changes: 5 additions & 5 deletions tests/smoke/Commands/init.smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tests:
options:
- dot-all
exit-status: 0
- name: init-non-interactive-name
- name: init-name
command:
shell:
- bash
Expand All @@ -28,7 +28,7 @@ tests:
trap 'rm -rf -- "$temp"' EXIT
mkdir "$temp/packagename"
cd "$temp/packagename"
juvix init -n
juvix init
juvix repl Package.juvix
stdout:
contains: '"packagename"'
Expand All @@ -42,21 +42,21 @@ tests:
temp=$(mktemp -d)
trap 'rm -rf -- "$temp"' EXIT
cd $temp
echo -e 'packagename\n\n\n' | juvix init
echo -e 'packagename\n\n\n' | juvix init -i
juvix repl Package.juvix
stdout:
contains: '"packagename"'
stdin: Package.name package
exit-status: 0
- name: init-version
- name: init-version-interactive
command:
shell:
- bash
script: |
temp=$(mktemp -d)
trap 'rm -rf -- "$temp"' EXIT
cd $temp
echo -e 'packagename\n1.2.3-prerel+meta\n\n' | juvix init
echo -e 'packagename\n1.2.3-prerel+meta\n\n' | juvix init -i
juvix repl Package.juvix
stdout:
contains: |
Expand Down

0 comments on commit bf71187

Please sign in to comment.