| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Okf.Cli
Description
Top-level CLI entry point for okf.
Synopsis
- data Command
- = Validate ValidateOptions
- | Index IndexOptions
- | Log LogOptions
- | GraphCommand GraphOptions
- | ShowConcept ShowOptions
- | Trust TrustOptions
- | Sources SourcesOptions
- | Computations ComputationsOptions
- | Concepts ConceptsOptions
- | Id IdOptions
- | Config ConfigCommand
- | Profile ProfileCommand
- | Kit KitCommand
- | Assist AssistOptions
- | Completions CompletionsShell
- | Help HelpCommand
- data ComputationsOptions = ComputationsOptions {
- bundlePath :: !FilePath
- data ConceptsOptions = ConceptsOptions {
- bundlePath :: !FilePath
- conceptTypes :: ![Text]
- fieldFilters :: ![ConceptFilter]
- presentFields :: ![FieldSelector]
- absentFields :: ![FieldSelector]
- showFields :: ![Text]
- profilePath :: !(Maybe FilePath)
- json :: !Bool
- data GraphOptions = GraphOptions {
- bundlePath :: !FilePath
- json :: !Bool
- data IdOptions = IdOptions {
- bundlePath :: !FilePath
- profilePath :: !FilePath
- idSub :: !IdSub
- data IdSub
- data IndexOptions = IndexOptions {
- bundlePath :: !FilePath
- write :: !Bool
- okfVersion :: !(Maybe Text)
- data ConfigCommand
- data LogAddOptions = LogAddOptions {}
- data LogOptions = LogOptions {
- bundlePath :: !FilePath
- checkStale :: !Bool
- sinceRef :: !(Maybe Text)
- logSub :: !LogSub
- data LogSub
- data Options = Options {}
- data ProfileCommand
- data ProfileDocumentOptions = ProfileDocumentOptions {
- registryRef :: !(Maybe Text)
- export :: !(Maybe Text)
- profilePath :: !(Maybe FilePath)
- outputPath :: !(Maybe FilePath)
- write :: !Bool
- timestamp :: !(Maybe Text)
- generatedBy :: !(Maybe Text)
- generatedAt :: !(Maybe Text)
- okfVersion :: !(Maybe Text)
- data ProfileListOptions = ProfileListOptions {
- registryRef :: !(Maybe Text)
- json :: !Bool
- data ProfileShowOptions = ProfileShowOptions {}
- data ShowOptions = ShowOptions {
- bundlePath :: !(Maybe FilePath)
- conceptIdText :: !(Maybe Text)
- profilePath :: !(Maybe FilePath)
- computationOnly :: !Bool
- conceptOrder :: !ConceptOrder
- data ValidateOptions = ValidateOptions {
- bundlePath :: !FilePath
- strictMode :: !Bool
- profilePath :: !(Maybe FilePath)
- profileEnforce :: !Bool
- logEnforce :: !Bool
- computationReport :: [Concept] -> [Text]
- conceptReport :: [Text] -> [Concept] -> [Text]
- conceptReportJson :: [Text] -> [Concept] -> Value
- parserInfo :: ParserInfo Options
- profileRegistryEnvVar :: String
- renderProfileDetail :: Text -> ProfileSpec -> [Text]
- renderProfileViolation :: CompiledProfile -> [Concept] -> ProfileViolation -> Text
- renderRegistryTable :: [RegistryEntry] -> [Text]
- runCli :: IO ()
- runCommand :: Command -> IO ()
- runLogAdd :: FilePath -> LogAddOptions -> IO ()
Documentation
Constructors
data ComputationsOptions Source #
Constructors
| ComputationsOptions | |
Fields
| |
Instances
| Show ComputationsOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ComputationsOptions -> ShowS # show :: ComputationsOptions -> String # showList :: [ComputationsOptions] -> ShowS # | |
| Eq ComputationsOptions Source # | |
Defined in Okf.Cli Methods (==) :: ComputationsOptions -> ComputationsOptions -> Bool # (/=) :: ComputationsOptions -> ComputationsOptions -> Bool # | |
data ConceptsOptions Source #
Constructors
| ConceptsOptions | |
Fields
| |
Instances
| Show ConceptsOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ConceptsOptions -> ShowS # show :: ConceptsOptions -> String # showList :: [ConceptsOptions] -> ShowS # | |
| Eq ConceptsOptions Source # | |
Defined in Okf.Cli Methods (==) :: ConceptsOptions -> ConceptsOptions -> Bool # (/=) :: ConceptsOptions -> ConceptsOptions -> Bool # | |
data GraphOptions Source #
Constructors
| GraphOptions | |
Fields
| |
Instances
| Show GraphOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> GraphOptions -> ShowS # show :: GraphOptions -> String # showList :: [GraphOptions] -> ShowS # | |
| Eq GraphOptions Source # | |
Defined in Okf.Cli | |
Constructors
| IdOptions | |
Fields
| |
data IndexOptions Source #
Constructors
| IndexOptions | |
Fields
| |
Instances
| Show IndexOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> IndexOptions -> ShowS # show :: IndexOptions -> String # showList :: [IndexOptions] -> ShowS # | |
| Eq IndexOptions Source # | |
Defined in Okf.Cli | |
data ConfigCommand Source #
Constructors
| ConfigShow | |
| ConfigPath | |
| ConfigInit !Bool | |
| ConfigAgent |
Instances
| Show ConfigCommand Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ConfigCommand -> ShowS # show :: ConfigCommand -> String # showList :: [ConfigCommand] -> ShowS # | |
| Eq ConfigCommand Source # | |
Defined in Okf.Cli Methods (==) :: ConfigCommand -> ConfigCommand -> Bool # (/=) :: ConfigCommand -> ConfigCommand -> Bool # | |
data LogAddOptions Source #
Constructors
| LogAddOptions | |
Instances
| Show LogAddOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> LogAddOptions -> ShowS # show :: LogAddOptions -> String # showList :: [LogAddOptions] -> ShowS # | |
| Eq LogAddOptions Source # | |
Defined in Okf.Cli Methods (==) :: LogAddOptions -> LogAddOptions -> Bool # (/=) :: LogAddOptions -> LogAddOptions -> Bool # | |
data LogOptions Source #
Constructors
| LogOptions | |
Fields
| |
Instances
| Show LogOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> LogOptions -> ShowS # show :: LogOptions -> String # showList :: [LogOptions] -> ShowS # | |
| Eq LogOptions Source # | |
Defined in Okf.Cli | |
Constructors
| LogPreview | |
| LogAdd LogAddOptions |
data ProfileCommand Source #
Constructors
| ProfileList ProfileListOptions | |
| ProfileShow ProfileShowOptions | |
| ProfileDocument ProfileDocumentOptions |
Instances
| Show ProfileCommand Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ProfileCommand -> ShowS # show :: ProfileCommand -> String # showList :: [ProfileCommand] -> ShowS # | |
| Eq ProfileCommand Source # | |
Defined in Okf.Cli Methods (==) :: ProfileCommand -> ProfileCommand -> Bool # (/=) :: ProfileCommand -> ProfileCommand -> Bool # | |
data ProfileDocumentOptions Source #
Constructors
| ProfileDocumentOptions | |
Fields
| |
Instances
| Show ProfileDocumentOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ProfileDocumentOptions -> ShowS # show :: ProfileDocumentOptions -> String # showList :: [ProfileDocumentOptions] -> ShowS # | |
| Eq ProfileDocumentOptions Source # | |
Defined in Okf.Cli Methods (==) :: ProfileDocumentOptions -> ProfileDocumentOptions -> Bool # (/=) :: ProfileDocumentOptions -> ProfileDocumentOptions -> Bool # | |
data ProfileListOptions Source #
Constructors
| ProfileListOptions | |
Fields
| |
Instances
| Show ProfileListOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ProfileListOptions -> ShowS # show :: ProfileListOptions -> String # showList :: [ProfileListOptions] -> ShowS # | |
| Eq ProfileListOptions Source # | |
Defined in Okf.Cli Methods (==) :: ProfileListOptions -> ProfileListOptions -> Bool # (/=) :: ProfileListOptions -> ProfileListOptions -> Bool # | |
data ProfileShowOptions Source #
Constructors
| ProfileShowOptions | |
Instances
| Show ProfileShowOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ProfileShowOptions -> ShowS # show :: ProfileShowOptions -> String # showList :: [ProfileShowOptions] -> ShowS # | |
| Eq ProfileShowOptions Source # | |
Defined in Okf.Cli Methods (==) :: ProfileShowOptions -> ProfileShowOptions -> Bool # (/=) :: ProfileShowOptions -> ProfileShowOptions -> Bool # | |
data ShowOptions Source #
Constructors
| ShowOptions | |
Fields
| |
Instances
| Show ShowOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ShowOptions -> ShowS # show :: ShowOptions -> String # showList :: [ShowOptions] -> ShowS # | |
| Eq ShowOptions Source # | |
Defined in Okf.Cli | |
data ValidateOptions Source #
Constructors
| ValidateOptions | |
Fields
| |
Instances
| Show ValidateOptions Source # | |
Defined in Okf.Cli Methods showsPrec :: Int -> ValidateOptions -> ShowS # show :: ValidateOptions -> String # showList :: [ValidateOptions] -> ShowS # | |
| Eq ValidateOptions Source # | |
Defined in Okf.Cli Methods (==) :: ValidateOptions -> ValidateOptions -> Bool # (/=) :: ValidateOptions -> ValidateOptions -> Bool # | |
computationReport :: [Concept] -> [Text] Source #
The lines okf computations prints, as data. Pure and separate from
runComputations so a test can assert the whole report rather than only the
accessors behind it; renderProfileDetail is exported for the same reason.
Concepts arrive in walkBundle order and keep it. Column widths are computed
over the selected rows only, so one unrelated long concept ID elsewhere in the
bundle cannot pad this report.
conceptReport :: [Text] -> [Concept] -> [Text] Source #
The lines okf concepts prints, as data: concept ID, type, one column per
requested key, and title last. Pure and separate from runConcepts so a
test can assert the whole report rather than only the accessors behind it, as
computationReport and renderProfileDetail already are.
The three default columns are the ones
conceptCandidates shows in the interactive concept
picker, so the two listings agree.
title comes last and is never padded, so a long title cannot push anything
off the right edge and a concept with no title simply ends the line. Column
widths are computed over the rows actually printed, so one unrelated long
concept ID elsewhere in the bundle cannot pad a filtered listing.
conceptReportJson :: [Text] -> [Concept] -> Value Source #
The rows okf concepts --json emits.
title is null when the concept has none, and fields is present even when
no key was requested, so a consumer never has to test for it. The values under
fields are the raw frontmatter values rather than the display text a column
shows: a JSON consumer wants a list back as a list.
profileRegistryEnvVar :: String Source #
Environment override for the registry okf profile reads.
renderProfileDetail :: Text -> ProfileSpec -> [Text] Source #
One profile's complete rule set. Every optional field prints as (none)
rather than being omitted, so the output shape does not change between
profiles and stays reliable to eyeball or grep. Type rules print in the order
the profile declares them, since that order is the author's.
renderProfileViolation :: CompiledProfile -> [Concept] -> ProfileViolation -> Text Source #
One deviation as one line. The ProfileSpec is here only so a missing
required field can carry the profile's own explanation of what that field is
for; every other case ignores it.
Exported so a test can assert a whole diagnostic line rather than only the
accessors behind it, as computationReport and renderProfileDetail already
are. The constructors that quote a frontmatter value back to the author ignore
both the CompiledProfile and the concept list, so such a test can pass any
compiled profile and an empty list.
renderRegistryTable :: [RegistryEntry] -> [Text] Source #
An aligned table: a header row plus one row per profile, columns padded to their widest value. Pure so it can be tested without evaluating any Dhall.
DESCRIPTION comes last so the existing columns keep their positions and a
long description cannot push anything off the right edge. Nothing follows it,
so it is never padded; an absent description reads -, matching ID FIELD.
runCommand :: Command -> IO () Source #