Skip to content

Commit

Permalink
docs: update generated docs and docsify main pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jahvon committed Sep 27, 2024
1 parent 29daebf commit 9b56919
Show file tree
Hide file tree
Showing 37 changed files with 497 additions and 309 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ brews:
directory: Formula
repository:
owner: jahvon
name: homebrew-flow
name: homebrew-tap
token: "{{ .Env.HOMEBREW_FLOW_GITHUB_TOKEN }}"
dependencies:
- name: xclip
Expand Down
9 changes: 1 addition & 8 deletions cmd/internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,8 @@ func RegisterConfigCmd(ctx *context.Context, rootCmd *cobra.Command) {
Short: "Update flow configuration values.",
}
registerConfigResetCmd(ctx, setCmd)
registerSetConfigCmd(ctx, setCmd)
registerViewConfigCmd(ctx, setCmd)
registerSetWorkspaceCmd(ctx, setCmd)
registerSetNamespaceCmd(ctx, setCmd)
registerSetWorkspaceModeCmd(ctx, setCmd)
registerSetLogModeCmd(ctx, setCmd)
registerSetTUICmd(ctx, setCmd)
registerRegisterTemplateCmd(ctx, setCmd)
registerSetSecretCmd(ctx, setCmd)
registerSetConfigCmd(ctx, setCmd)
rootCmd.AddCommand(setCmd)
}

Expand Down
25 changes: 16 additions & 9 deletions cmd/internal/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ func RegisterExecCmd(ctx *context.Context, rootCmd *cobra.Command) {
Aliases: executable.SortedValidVerbs(),
Short: "Execute a flow by ID.",
Long: execDocumentation + fmt.Sprintf(
"\n\n%s\n\nSee %s for more information on executable verbs."+
"See %s for more information on executable IDs.",
execExamples, io.TypesDocsURL("flowfile", "ExecutableVerb"),
"\n\nSee %s for more information on executable verbs and "+
"%s for more information on executable IDs.\n\n%s",
io.TypesDocsURL("flowfile", "ExecutableVerb"),
io.TypesDocsURL("flowfile", "ExecutableRef"),
execExamples,
),
Args: cobra.MinimumNArgs(1),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
Expand Down Expand Up @@ -371,24 +372,30 @@ func pendingFormFields(ctx *context.Context, rootExec *executable.Executable) []
var (
//nolint:lll
execDocumentation = `
Execute a flow where <executable-id> is the target executable's ID in the form of 'ws/ns:name'.
Execute an executable where EXECUTABLE_ID is the target executable's ID in the form of 'ws/ns:name'.
The flow subcommand used should match the target executable's verb or one of its aliases.
If the target executable accept arguments, they can be passed in the form of flag or positional arguments.
Flag arguments are specified with the format 'flag=value' and positional arguments are specified as values without any prefix.
`
execExamples = `
# Execute the 'build' flow in the current workspace and namespace
#### Examples
**Execute the 'build' flow in the current workspace and namespace**
flow exec build
flow run build # Equivalent to the above since 'run' is an alias for the 'exec' verb
# Execute the 'docs' flow with the 'show' verb in the current workspace and namespace
flow run build (Equivalent to the above since 'run' is an alias for the 'exec' verb)
**Execute the 'docs' flow with the 'show' verb in the current workspace and namespace**
flow show docs
# Execute the 'build' flow in the 'ws' workspace and 'ns' namespace
**Execute the 'build' flow in the 'ws' workspace and 'ns' namespace**
flow exec ws/ns:build
# Execute the 'build' flow in the 'ws' workspace and 'ns' namespace with flag and positional arguments
**Execute the 'build' flow in the 'ws' workspace and 'ns' namespace with flag and positional arguments**
flow exec ws/ns:build flag1=value1 flag2=value2 value3 value4
`
)
88 changes: 8 additions & 80 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,86 +8,14 @@
flow is a customizable and interactive CLI tool designed to streamline how you manage and run local development and
operations workflows.

**This project is currently in beta and documentation is a work in progress.** We welcome contributions and feedback.
**This project is currently in beta and documentation is a work in progress.** Contributions and feedback are welcome.

## Features
## Features <!-- {docsify-ignore} -->

- **Task Runner**: Easily define, manage, and run your tasks (called [executables](guide/executable.md)) from the command line.
- **Secret Management**: Safely store sensitive secrets in a secure local [vault](guide/vault.md), easily referencable in your executable configurations.
- **Input Handling**: Pass values into executables via environment variables defined by configuration, flags, or interactive prompts, ensuring your workflows are flexible and easy to use.
- **Executable Organization**: Group your executables into workspace and namespace, making them easily discoverable and accessible from anywhere on your system. Tag your executables and workspaces for easy filtering and searching.
- **Customizable TUI**: Enjoy a seamless [TUI experience](guide/interactive.md) with log formatting, log archiving, and execution notifications, enhancing your productivity.
- **Generate w/ Templates and Comments**: Automatically generate executable configurations and workspace scaffolding from [flow file templates](guide/templating.md) or comments in your script files, making it easy to onboard new executables.
- **Comprehensive Commands**:
- `get` and `list`: Retrieve and display executable details, formatted as markdown documentation, YAML, or JSON.
- `library`: Access a fully searchable and interactive TUI for running and exploring executables.

## Installation and setup

### System Requirements

At this time, flow is only supported on Linux and MacOS systems.
While it may work on Windows, it has not been tested and is not officially supported.

### Installation
`
You can install the pre-compiled binary or compile from source. To install the latest pre-compiled binary,
run the following command:

```bash
curl -sSL https://raw.githubusercontent.com/jahvon/flow/main/scripts/install.sh | bash
```

Alternatively, you can install the binary via Go using the following command:

```bash
go install github.com/jahvon/flow@latest
```

### Autocompletion

flow supports autocompletion for bash, zsh, and fish shells. Setup depends on the shell you are using. For instance, if
you are using zsh with oh-my-zsh, you can run the following command to generate the autocompletion script:

```bash
flow completion zsh > ~/.oh-my-zsh/completions/_flow
```

## Getting started

### Setting up a workspace

A Workspace is a directory that contains workflows and configuration files for flow to manage.
A workspace can be created anywhere on your system but must be registered in the user config file in order to
have executables discovered by flow.

To create a new workspace:

```bash
flow init workspace <name> <path>
```

This command will register the Workspace and create the root config file for you.
For more information on Workspaces and it's config, see [Workspaces](/types/workspace.md).

### Defining executables

Executables are the core of flow. Each executable is driven by its definition within a flow file (`*.flow`).
There are several types of executables that can be defined. For more information on Executables and the flow file, see [FlowFile.md](types/flowfile.md).

There is also a JSON Schema that can be used in IDEs with the Language Server Protocol (LSP) to perform intelligent
suggestions. You can add the following comment to the top of your flow files to enable this:

```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/jahvon/flow/HEAD/schemas/flowfile_schema.json
```

See the [schemas](../schemas/) directory all available schemas.

### Running and managing executables

The main command for running executables is `flow exec`. This command will execute the workflow with the provided
executable ID. `exec` can be replaced with any verb known to flow but should match the verb defined in the flow file
configurations or an alias of that verb.

As you make changes to executables on your system, you can run `flow sync` to trigger a re-index of your executables.
- **Secret Vault**: Store sensitive secrets in a secure local [vault](guide/vault.md).
- **Template Generator**: Generate executables and workspace scaffolding with [flow file templates](guide/templating.md).
- **TUI Library**: Explore and run executables from the interactive and searchable TUI [library](cli/flow_library.md).
- **Executable Organizer**: Group, reference, and search for executables by workspace, namespace, verbs, and tags.
- **Input Handler**: Pass values into executables with environment variables defined by secrets, command-line args, or interactive prompts.
- **Customizable TUI**: Personalize your [TUI experience](guide/interactive.md) with settings for log formatting, log archiving, and execution notifications, and more.
4 changes: 3 additions & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
- [flow](README.md "flow documentation")
- [Home](README.md "flow documentation")
- [Install](installation.md "Installation guide")
- [Quick start](quickstart.md "Quick start guide")

- User guides

Expand Down
16 changes: 8 additions & 8 deletions docs/cli/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
- [flow](../README.md "flow documentation")
- [Home](../README.md "flow documentation")
- [Install](../installation.md "Installation guide")
- [Quick Start](../quickstart.md "Quick start guide")

- Reference
- [CLI commands](README.md "Command line interface reference")
- [flow exec](flow_exec.md)
- [flow get](flow_get.md)
- [flow init](flow_init.md)
- [flow library](flow_library.md)
- [flow list](flow_list.md)
- [flow logs](flow_logs.md)
- [flow remove](flow_remove.md)
- [flow set](flow_set.md)
- [flow template](flow_template.md)
- [flow config](flow_config.md)
- [flow workspace](flow_workspace.md)
- [flow secret](flow_secret.md)
- [flow sync](flow_sync.md)
- [flow version](flow_version.md)
- [flow logs](flow_logs.md)
- [Configuration files](../types/README.md "Configuration file reference")
7 changes: 0 additions & 7 deletions docs/cli/flow_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@ Update flow configuration values.
### SEE ALSO

* [flow](flow.md) - flow is a command line interface designed to make managing and running development workflows easier.
* [flow config log-mode](flow_config_log-mode.md) - Set the default log mode.
* [flow config namespace](flow_config_namespace.md) - Change the current namespace.
* [flow config register](flow_config_register.md) - Register a flowfile template.
* [flow config reset](flow_config_reset.md) - Restore the default flow configuration values. This will overwrite the current configuration.
* [flow config set](flow_config_set.md) - Update flow configuration values.
* [flow config set](flow_config_set.md) - Update or create a secret in the flow secret vault.
* [flow config tui](flow_config_tui.md) - Enable or disable the interactive terminal UI experience.
* [flow config view](flow_config_view.md) - View the current global configuration values.
* [flow config workspace](flow_config_workspace.md) - Change the current workspace.
* [flow config workspace-mode](flow_config_workspace-mode.md) - Switch between fixed and dynamic workspace modes.

11 changes: 6 additions & 5 deletions docs/cli/flow_config_set.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
## flow config set

Update or create a secret in the flow secret vault.

```
flow config set NAME [VALUE] [flags]
```
Update flow configuration values.

### Options

Expand All @@ -23,4 +19,9 @@ flow config set NAME [VALUE] [flags]
### SEE ALSO

* [flow config](flow_config.md) - Update flow configuration values.
* [flow config set log-mode](flow_config_set_log-mode.md) - Set the default log mode.
* [flow config set namespace](flow_config_set_namespace.md) - Change the current namespace.
* [flow config set tui](flow_config_set_tui.md) - Enable or disable the interactive terminal UI experience.
* [flow config set workspace](flow_config_set_workspace.md) - Change the current workspace.
* [flow config set workspace-mode](flow_config_set_workspace-mode.md) - Switch between fixed and dynamic workspace modes.

22 changes: 14 additions & 8 deletions docs/cli/flow_exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,35 @@ Execute a flow by ID.
### Synopsis


Execute a flow where <executable-id> is the target executable's ID in the form of 'ws/ns:name'.
Execute an executable where EXECUTABLE_ID is the target executable's ID in the form of 'ws/ns:name'.
The flow subcommand used should match the target executable's verb or one of its aliases.

If the target executable accept arguments, they can be passed in the form of flag or positional arguments.
Flag arguments are specified with the format 'flag=value' and positional arguments are specified as values without any prefix.


See https://flowexec.io/#/types/flowfile#ExecutableVerb for more information on executable verbs and https://flowexec.io/#/types/flowfile#ExecutableRef for more information on executable IDs.


#### Examples
**Execute the 'build' flow in the current workspace and namespace**

# Execute the 'build' flow in the current workspace and namespace
flow exec build
flow run build # Equivalent to the above since 'run' is an alias for the 'exec' verb

# Execute the 'docs' flow with the 'show' verb in the current workspace and namespace
flow run build (Equivalent to the above since 'run' is an alias for the 'exec' verb)

**Execute the 'docs' flow with the 'show' verb in the current workspace and namespace**

flow show docs

# Execute the 'build' flow in the 'ws' workspace and 'ns' namespace
**Execute the 'build' flow in the 'ws' workspace and 'ns' namespace**

flow exec ws/ns:build

# Execute the 'build' flow in the 'ws' workspace and 'ns' namespace with flag and positional arguments
flow exec ws/ns:build flag1=value1 flag2=value2 value3 value4
**Execute the 'build' flow in the 'ws' workspace and 'ns' namespace with flag and positional arguments**

flow exec ws/ns:build flag1=value1 flag2=value2 value3 value4

See https://github.com/jahvon/flow/blob/main/docs/types/flowfile.md#ExecutableVerb for more information on executable verbs.See https://github.com/jahvon/flow/blob/main/docs/types/flowfile.md#ExecutableRef for more information on executable IDs.

```
flow exec EXECUTABLE_ID [args...] [flags]
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/flow_library_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ View an executable's documentation. The executable is found by reference.
View an executable by the executable's verb and ID.
The target executable's ID should be in the form of 'ws/ns:name' and the verb should match the target executable's verb or one of its aliases.

See https://github.com/jahvon/flow/blob/main/docs/types/flowfile.md#ExecutableVerb for more information on executable verbs.
See https://github.com/jahvon/flow/blob/main/docs/types/flowfile.md#ExecutableRef for more information on executable IDs.
See https://flowexec.io/#/types/flowfile#ExecutableVerb for more information on executable verbs.
See https://flowexec.io/#/types/flowfile#ExecutableRef for more information on executable IDs.

```
flow library view VERB ID [flags]
Expand Down
87 changes: 87 additions & 0 deletions docs/demo.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# VHS documentation
#
# Output:
# Output <path>.gif Create a GIF output at the given <path>
# Output <path>.mp4 Create an MP4 output at the given <path>
# Output <path>.webm Create a WebM output at the given <path>
#
# Require:
# Require <string> Ensure a program is on the $PATH to proceed
#
# Settings:
# Set FontSize <number> Set the font size of the terminal
# Set FontFamily <string> Set the font family of the terminal
# Set Height <number> Set the height of the terminal
# Set Width <number> Set the width of the terminal
# Set LetterSpacing <float> Set the font letter spacing (tracking)
# Set LineHeight <float> Set the font line height
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
# Set Theme <json|string> Set the theme of the terminal
# Set Padding <number> Set the padding of the terminal
# Set Framerate <number> Set the framerate of the recording
# Set PlaybackSpeed <float> Set the playback speed of the recording
# Set MarginFill <file|#000000> Set the file or color the margin will be filled with.
# Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set.
# Set BorderRadius <number> Set terminal border radius, in pixels.
# Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight)
# Set WindowBarSize <number> Set window bar size, in pixels. Default is 40.
# Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms.
#
# Sleep:
# Sleep <time> Sleep for a set amount of <time> in seconds
#
# Type:
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
# <time> delay between each character
#
# Keys:
# Escape[@<time>] [number] Press the Escape key
# Backspace[@<time>] [number] Press the Backspace key
# Delete[@<time>] [number] Press the Delete key
# Insert[@<time>] [number] Press the Insert key
# Down[@<time>] [number] Press the Down key
# Enter[@<time>] [number] Press the Enter key
# Space[@<time>] [number] Press the Space key
# Tab[@<time>] [number] Press the Tab key
# Left[@<time>] [number] Press the Left Arrow key
# Right[@<time>] [number] Press the Right Arrow key
# Up[@<time>] [number] Press the Up Arrow key
# Down[@<time>] [number] Press the Down Arrow key
# PageUp[@<time>] [number] Press the Page Up key
# PageDown[@<time>] [number] Press the Page Down key
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
#
# Display:
# Hide Hide the subsequent commands from the output
# Show Show the subsequent commands in the output

Output demo.gif
Require flow

# Setup
Set Shell "bash"
Set FontSize 32
Set Width 3200
Set Height 1200

# Launch flow library
Type "flow library"
Sleep 2s
Enter

# Navigate to flow workspace / examples namespace
Sleep 5s
Down@1s
Space@1s
Sleep 5s
Down@1s 3
Sleep 3s

# Pick an executable to run
Right@1s
Sleep 2s
Down@3s 5

# Run the selected executable
Type "r"
Sleep 5s
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Be sure to regenerate the JSON schema files and markdown documentation before su

### Working with tuikit

The `flow` project uses the [tuikit](github.com/jahvon/tuikit) framework for building the terminal UI.
The `flow` project uses the [tuikit](tuikit.md) framework for building the terminal UI.
Contributions to the components and helpers in `tuikit` are welcome.

_You should test all tuikit changes with a local flow build before submitting a PR._
Expand Down
Loading

0 comments on commit 9b56919

Please sign in to comment.