summaryrefslogtreecommitdiff
path: root/src/Command/Extract.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-05-24 09:37:52 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-05-24 15:37:08 +0200
commita5f20f40840a0cbc1580261bff3d3a7fd2cdc29b (patch)
tree49a26ca92417e1d9151ea2c5508f7dbc46a6e45f /src/Command/Extract.hs
parent76370492c9c0cdbb51b4f7c14e082c04b0b223d5 (diff)
Parse parentheses in job reference
Diffstat (limited to 'src/Command/Extract.hs')
-rw-r--r--src/Command/Extract.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Command/Extract.hs b/src/Command/Extract.hs
index b24a1af..4336b29 100644
--- a/src/Command/Extract.hs
+++ b/src/Command/Extract.hs
@@ -31,9 +31,10 @@ instance CommandArgumentsType ExtractArguments where
extractDestination <- return (last args)
return ExtractArguments {..}
where
- toArtifactRef tref = case T.splitOn "." (T.pack tref) of
- parts@(_:_:_) -> return ( JobRef (init parts), ArtifactName (last parts) )
- _ -> throwError $ "too few parts in artifact ref ‘" <> tref <> "’"
+ toArtifactRef tref = case T.breakOnEnd "." (T.pack tref) of
+ (jobref', aref) | Just ( jobref, '.' ) <- T.unsnoc jobref'
+ -> return ( parseJobRef jobref, ArtifactName aref )
+ _ -> throwError $ "too few parts in artifact ref ‘" <> tref <> "’"
_ -> throwError "too few arguments"
data ExtractOptions = ExtractOptions