From a589e61c2b807196696632eb17e8ad573daa9c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Fri, 11 Sep 2026 21:20:46 +0200 Subject: Use colon as preferred job ID separator Changelog: Colon `:` is now accepted and preferred as job ID separator. --- src/Command/Extract.hs | 5 ++--- src/Command/Run.hs | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/Command') diff --git a/src/Command/Extract.hs b/src/Command/Extract.hs index 8dee537..3f78e2e 100644 --- a/src/Command/Extract.hs +++ b/src/Command/Extract.hs @@ -32,9 +32,8 @@ instance CommandArgumentsType ExtractArguments where extractDestination <- return (last args) return ExtractArguments {..} where - toArtifactRef tref = case T.breakOnEnd "." (T.pack tref) of - (jobref', aref) | Just ( jobref, '.' ) <- T.unsnoc jobref' - -> return ( parseJobRef jobref, ArtifactName aref ) + toArtifactRef tref = case parseJobRefParts $ T.pack tref of + parts@(_ : _) -> return ( JobRef $ init parts, ArtifactName $ last parts ) _ -> throwError $ "too few parts in artifact ref ‘" <> tref <> "’" _ -> throwError "too few arguments" diff --git a/src/Command/Run.hs b/src/Command/Run.hs index ccd4bfa..6419c58 100644 --- a/src/Command/Run.hs +++ b/src/Command/Run.hs @@ -10,6 +10,7 @@ import Control.Monad.IO.Class import Data.Char import Data.Containers.ListUtils +import Data.Either import Data.List import Data.Maybe import Data.Text (Text) @@ -314,10 +315,14 @@ cmdRun (RunCommand RunOptions {..} args) = do ] let ( nameOptions, jobOptions ) = partition (T.all $ \c -> isAlphaNum c || c == '_') args - ( refOptions, exprOptions ) = partition (\r -> "." `T.isInfixOf` r && not (".." `T.isInfixOf` r)) jobOptions + ( refOptions, exprOptions ) = partitionEithers $ map splitRefs jobOptions + splitRefs t = case parseJobRef t of + JobRef [ e ] -> Right e + JobRef [ e, "" ] -> Right e + ref -> Left ref argumentJobs <- argumentJobSource $ map JobName nameOptions - refJobs <- refJobSource $ map parseJobRef refOptions + refJobs <- refJobSource refOptions exprJobs <- forM exprOptions $ \trange -> case parseRangeExpression trange of -- cgit v1.2.3