bm-0.2.0.0: open bookmarks and queries from the command line
CopyrightCopyright (c) 2021-2023 Travis Cardwell
LicenseMIT
Safe HaskellSafe-Inferred
LanguageHaskell2010

BM

Description

 
Synopsis

Constants

version :: String Source #

bm version string ("bm-haskell X.X.X.X")

Since: 0.1.0.0

Types

type Argument = String Source #

CLI argument or process argument

Since: 0.1.0.0

type Command = FilePath Source #

Process command

This command is executed with a single URL argument to open a bookmark/query.

Since: 0.1.0.0

type Error = String Source #

Error message

Since: 0.1.0.0

type Keyword = String Source #

Bookmark keyword

The configuration file defines a hierarchy of keywords that are matched against CLI arguments to determine which bookmark/query to open.

Since: 0.1.0.0

type ParameterName = String Source #

Query parameter name

Since: 0.1.0.0

type ParameterValue = String Source #

Query parameter value

Since: 0.1.0.0

type Trace = String Source #

Trace line for debugging

Since: 0.1.0.0

type Url = String Source #

Bookmark or query action URL

Since: 0.1.0.0

data Config Source #

Configuration

YAML attributes:

  • command: top-level command (string, default depends on the OS)
  • args: bookmarks (array of Bookmark)

Default commands:

  • Linux: xdg-open
  • Windows: start
  • macOS: open

Since: 0.1.0.0

Constructors

Config 

Instances

Instances details
FromJSON Config Source # 
Instance details

Defined in BM

Show Config Source # 
Instance details

Defined in BM

data Bookmark Source #

Bookmark definition

YAML attributes:

  • keyword: bookmark keyword (string)
  • command: command for this bookmark and children (string, optional)
  • url: bookmark URL (string, optional)
  • query: bookmark query definition (Query, optional)
  • args: child bookmarks (array of Bookmark, optional)

A command be set to override the top-level command, but this is generally not done. If a bookmark is selected and there is no URL, the first child is processed. Only one of query and args may be present.

Since: 0.1.0.0

Constructors

Bookmark 

Instances

Instances details
FromJSON Bookmark Source # 
Instance details

Defined in BM

Show Bookmark Source # 
Instance details

Defined in BM

data Query Source #

Query definition

YAML attributes:

  • action: URL (string)
  • parameter: query parameter name (string, default: q)
  • hidden: array of constant parameters (Parameter)

Since: 0.1.0.0

Instances

Instances details
FromJSON Query Source # 
Instance details

Defined in BM

Show Query Source # 
Instance details

Defined in BM

Methods

showsPrec :: Int -> Query -> ShowS #

show :: Query -> String #

showList :: [Query] -> ShowS #

data Parameter Source #

HTTP GET parameter definition

YAML attributes:

  • name: parameter name
  • value: constant parameter value

Since: 0.1.0.0

Constructors

Parameter 

Instances

Instances details
FromJSON Parameter Source # 
Instance details

Defined in BM

Show Parameter Source # 
Instance details

Defined in BM

data Proc Source #

Process specification

Since: 0.1.0.0

Constructors

Proc 

Fields

Instances

Instances details
Show Proc Source # 
Instance details

Defined in BM

Methods

showsPrec :: Int -> Proc -> ShowS #

show :: Proc -> String #

showList :: [Proc] -> ShowS #

Eq Proc Source # 
Instance details

Defined in BM

Methods

(==) :: Proc -> Proc -> Bool #

(/=) :: Proc -> Proc -> Bool #

API

run :: Config -> [Argument] -> (Either Error Proc, [Trace]) Source #

Determine the process to execute for the given config and CLI arguments

Since: 0.1.0.0

getCompletion Source #

Arguments

:: Config 
-> [Argument]

current CLI arguments, last one being completed

-> [Argument]

completion options

Get CLI completion options

Since: 0.1.0.0