Expand description
opstr is a library to apply operations to strings.
§Objects
Configuration
represents how the output shall be represented and which locale shall be used for Unicode operations.LibError
is anenum
of all possible error types that can occurArg
represents one input argument (final content, in the case of stdin/file).Args
is a sequence of them.
§Concepts
- Operations provide a priority. A priority defines how much sense this request made. A priority of 1.0 means “very likely what you looked for” (on the CLI, the result will be shown on the bottom). A priority close to 0.0 means “unlikely helpful” (on the CLI, the result will be printed out first). Results with priority 0.0 make no sense and will be discarded immediately.
§API
list_all_ops
returns the list of supported operationslist_matching_ops
returns the list of possible operations for the provided argumentsmatcher::run_op
returns theOutput
after running the one operation specifiedmatcher::run_matching_ops
runs all operations appropriate for the provided arguments and writes the result to stdout & stderr
§Notes
- The CLI output is always valid UTF-8. This might change in the future, but in the current release, this is the case.
Arg
is either Unicode content (Chars
) or an arbitrary byte sequence (Bytes
).Bytes
is not yet supported.Output
abstracts the type of result of an operation.Configuration.syntax
defines which formal grammar shall be used for representation. The default representation for humans does not have a specification.
Structs§
- Args
- An ordered container for arguments
- Configuration
- Global application settings (mainly to configure representation)
Enums§
- Arg
- An argument for an operation
- Color
Scheme - Enum
ColorScheme
in use to represent the diagnostic message. - LibError
LibError
represents one of all possible error cases possible to occur in this library- Output
- Output is the result of an operation ready for user-friendly representation through the
print
method
Functions§
- list_
all_ ops - Return the list of all operations as
Output::Association
of (name, description) entries. - list_
color_ schemes - Run all operations appropriate for the provided
Args
. Write the result to stdout & stderr, so we return()
- list_
matching_ ops - Return the ordered list of appropriate operations as
Output::Association
of (name, description) entries. - run_
matching_ ops - Run all operations appropriate for the provided
Args
. Write the result to stdout & stderr, so we return()
- run_op
- Return
(op_name, Output)
as result of running the specified operationop_name
withArgs