-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59bea00
commit 2105eb1
Showing
5 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
|
||
module Command.NextID where | ||
|
||
import Control.Monad (unless) | ||
import Data.Maybe (fromMaybe) | ||
import System.Exit (die) | ||
|
||
import Security.Advisories.Git (getRepoRoot) | ||
import Security.Advisories.Core.HsecId (printHsecId, getNextHsecId) | ||
import Security.Advisories.Filesystem (isSecurityAdvisoriesRepo, getGreatestId) | ||
|
||
runNextIDCommand :: Maybe FilePath -> IO () | ||
runNextIDCommand mPath = do | ||
let | ||
path = fromMaybe "." mPath | ||
repoPath <- getRepoRoot path >>= \case | ||
Left _ -> die "Not a git repo" | ||
Right a -> pure a | ||
isRepo <- isSecurityAdvisoriesRepo repoPath | ||
unless isRepo $ | ||
die "Not a security-advisories repo" | ||
|
||
getGreatestId repoPath >>= getNextHsecId >>= putStrLn . printHsecId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters