Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghcup-hs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
ghcup-hs
Commits
96cb99e1
Verified
Commit
96cb99e1
authored
3 years ago
by
Julian Ospald
Browse files
Options
Downloads
Patches
Plain Diff
Improve --repository completion
parent
2e08efee
No related branches found
No related tags found
No related merge requests found
Pipeline
#48612
passed
3 years ago
Stage: checks
Stage: quick-test
Stage: test
Stage: expensive-test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/ghcup/GHCup/OptParse/Common.hs
+8
-5
8 additions, 5 deletions
app/ghcup/GHCup/OptParse/Common.hs
app/ghcup/GHCup/OptParse/Compile.hs
+7
-2
7 additions, 2 deletions
app/ghcup/GHCup/OptParse/Compile.hs
with
15 additions
and
7 deletions
app/ghcup/GHCup/OptParse/Common.hs
+
8
−
5
View file @
96cb99e1
...
@@ -302,14 +302,17 @@ gpgParser s' | t == T.pack "strict" = Right GPGStrict
...
@@ -302,14 +302,17 @@ gpgParser s' | t == T.pack "strict" = Right GPGStrict
toolCompleter
::
Completer
toolCompleter
::
Completer
toolCompleter
=
listCompleter
[
"ghc"
,
"cabal"
,
"hls"
,
"stack"
]
toolCompleter
=
listCompleter
[
"ghc"
,
"cabal"
,
"hls"
,
"stack"
]
gitFileUri
::
[
String
]
->
Completer
gitFileUri
add
=
mkCompleter
$
fileUri'
([
"git://"
]
<>
add
)
fileUri
::
Completer
fileUri
::
Completer
fileUri
=
mkCompleter
fileUri'
fileUri
=
mkCompleter
$
fileUri'
[]
fileUri'
::
String
->
IO
[
String
]
fileUri'
::
[
String
]
->
String
->
IO
[
String
]
fileUri'
=
\
case
fileUri'
add
=
\
case
""
->
do
""
->
do
pwd
<-
getCurrentDirectory
pwd
<-
getCurrentDirectory
pure
[
"https://"
,
"http://"
,
"file:///"
,
"file://"
<>
pwd
<>
"/"
]
pure
$
[
"https://"
,
"http://"
,
"file:///"
,
"file://"
<>
pwd
<>
"/"
]
<>
add
xs
xs
|
"file:///"
`
isPrefixOf
`
xs
->
fmap
(
"file://"
<>
)
<$>
|
"file:///"
`
isPrefixOf
`
xs
->
fmap
(
"file://"
<>
)
<$>
case
stripPrefix
"file://"
xs
of
case
stripPrefix
"file://"
xs
of
...
@@ -476,7 +479,7 @@ toolDlCompleter :: Tool -> Completer
...
@@ -476,7 +479,7 @@ toolDlCompleter :: Tool -> Completer
toolDlCompleter
tool
=
mkCompleter
$
\
case
toolDlCompleter
tool
=
mkCompleter
$
\
case
""
->
pure
(
initUrl
tool
<>
[
"https://"
,
"http://"
,
"file:///"
])
""
->
pure
(
initUrl
tool
<>
[
"https://"
,
"http://"
,
"file:///"
])
word
word
|
"file://"
`
isPrefixOf
`
word
->
fileUri'
word
|
"file://"
`
isPrefixOf
`
word
->
fileUri'
[]
word
-- downloads.haskell.org
-- downloads.haskell.org
|
"https://downloads.haskell.org/"
`
isPrefixOf
`
word
->
|
"https://downloads.haskell.org/"
`
isPrefixOf
`
word
->
fmap
(
completePrefix
word
)
.
prefixMatch
(
FP
.
takeFileName
word
)
<$>
fromHRef
word
fmap
(
completePrefix
word
)
.
prefixMatch
(
FP
.
takeFileName
word
)
<$>
fromHRef
word
...
...
This diff is collapsed.
Click to expand it.
app/ghcup/GHCup/OptParse/Compile.hs
+
7
−
2
View file @
96cb99e1
...
@@ -173,7 +173,10 @@ ghcCompileOpts =
...
@@ -173,7 +173,10 @@ ghcCompileOpts =
(
short
'g'
<>
long
"git-ref"
<>
metavar
"GIT_REFERENCE"
<>
help
(
short
'g'
<>
long
"git-ref"
<>
metavar
"GIT_REFERENCE"
<>
help
"The git commit/branch/ref to build from"
"The git commit/branch/ref to build from"
)
<*>
)
<*>
optional
(
option
str
(
short
'r'
<>
long
"repository"
<>
metavar
"GIT_REPOSITORY"
<>
help
"The git repository to build from (defaults to GHC upstream)"
))
optional
(
option
str
(
short
'r'
<>
long
"repository"
<>
metavar
"GIT_REPOSITORY"
<>
help
"The git repository to build from (defaults to GHC upstream)"
<>
completer
(
gitFileUri
[
"https://gitlab.haskell.org/ghc/ghc.git"
])
))
)))
)))
<*>
option
<*>
option
(
eitherReader
(
eitherReader
...
@@ -285,7 +288,9 @@ hlsCompileOpts =
...
@@ -285,7 +288,9 @@ hlsCompileOpts =
(
short
'g'
<>
long
"git-ref"
<>
metavar
"GIT_REFERENCE"
<>
help
(
short
'g'
<>
long
"git-ref"
<>
metavar
"GIT_REFERENCE"
<>
help
"The git commit/branch/ref to build from"
"The git commit/branch/ref to build from"
)
<*>
)
<*>
optional
(
option
str
(
short
'r'
<>
long
"repository"
<>
metavar
"GIT_REPOSITORY"
<>
help
"The git repository to build from (defaults to GHC upstream)"
))
optional
(
option
str
(
short
'r'
<>
long
"repository"
<>
metavar
"GIT_REPOSITORY"
<>
help
"The git repository to build from (defaults to GHC upstream)"
<>
completer
(
gitFileUri
[
"https://github.com/haskell/haskell-language-server.git"
])
))
)))
)))
<*>
optional
<*>
optional
(
option
(
option
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment