Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Dec 10, 2024
1 parent 044e960 commit d17647a
Show file tree
Hide file tree
Showing 30 changed files with 138 additions and 45 deletions.
3 changes: 3 additions & 0 deletions docs/cli/add.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# `pitchfork add`

- **Usage**: `pitchfork add`
- **Aliases**: `a`

Add a new daemon to pitchfork.toml
3 changes: 3 additions & 0 deletions docs/cli/clean.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# `pitchfork clean`

- **Usage**: `pitchfork clean`
- **Aliases**: `c`

Removes stopped/failed daemons from `pitchfork list`
60 changes: 47 additions & 13 deletions docs/cli/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "Add a new daemon to pitchfork.toml",
"name": "add",
"aliases": [],
"aliases": [
"a"
],
"hidden_aliases": [],
"examples": []
},
Expand All @@ -30,8 +33,11 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "Removes stopped/failed daemons from `pitchfork list`",
"name": "clean",
"aliases": [],
"aliases": [
"c"
],
"hidden_aliases": [],
"examples": []
},
Expand Down Expand Up @@ -69,8 +75,11 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "Prevent a daemon from restarting",
"name": "disable",
"aliases": [],
"aliases": [
"d"
],
"hidden_aliases": [],
"examples": []
},
Expand All @@ -84,8 +93,11 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "Allow a daemon to start",
"name": "enable",
"aliases": [],
"aliases": [
"e"
],
"hidden_aliases": [],
"examples": []
},
Expand All @@ -99,8 +111,11 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "List all daemons",
"name": "list",
"aliases": [],
"aliases": [
"ls"
],
"hidden_aliases": [],
"examples": []
},
Expand Down Expand Up @@ -160,7 +175,9 @@
"hide": false,
"help": "Displays logs for daemon(s)",
"name": "logs",
"aliases": [],
"aliases": [
"l"
],
"hidden_aliases": [],
"examples": []
},
Expand All @@ -174,8 +191,11 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "Remove a daemon from pitchfork.toml",
"name": "remove",
"aliases": [],
"aliases": [
"rm"
],
"hidden_aliases": [],
"examples": []
},
Expand Down Expand Up @@ -220,7 +240,9 @@
"hide": false,
"help": "Runs a one-off daemon",
"name": "run",
"aliases": [],
"aliases": [
"r"
],
"hidden_aliases": [],
"examples": []
},
Expand All @@ -246,7 +268,9 @@
"hide": false,
"help": "Starts a daemon from a pitchfork.toml file",
"name": "start",
"aliases": [],
"aliases": [
"s"
],
"hidden_aliases": [],
"examples": []
},
Expand All @@ -260,8 +284,11 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "Display the status of a daemons",
"name": "status",
"aliases": [],
"aliases": [
"stat"
],
"hidden_aliases": [],
"examples": []
},
Expand All @@ -275,8 +302,11 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "Kill a running daemon",
"name": "stop",
"aliases": [],
"aliases": [
"kill"
],
"hidden_aliases": [],
"examples": []
},
Expand Down Expand Up @@ -404,7 +434,7 @@
"args": [],
"flags": [],
"mounts": [],
"hide": false,
"hide": true,
"help": "Generates a usage spec for the CLI",
"help_long": "Generates a usage spec for the CLI\n\nhttps://usage.jdx.dev",
"name": "usage",
Expand All @@ -422,8 +452,12 @@
"flags": [],
"mounts": [],
"hide": false,
"help": "Wait for a daemon to stop, tailing the logs along the way",
"help_long": "Wait for a daemon to stop, tailing the logs along the way\n\nExits with the same status code as the daemon",
"name": "wait",
"aliases": [],
"aliases": [
"w"
],
"hidden_aliases": [],
"examples": []
}
Expand Down
3 changes: 3 additions & 0 deletions docs/cli/disable.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# `pitchfork disable`

- **Usage**: `pitchfork disable`
- **Aliases**: `d`

Prevent a daemon from restarting
3 changes: 3 additions & 0 deletions docs/cli/enable.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# `pitchfork enable`

- **Usage**: `pitchfork enable`
- **Aliases**: `e`

Allow a daemon to start
1 change: 0 additions & 1 deletion docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@
- [`pitchfork supervisor start [-f --force]`](/cli/supervisor/start.md)
- [`pitchfork supervisor status`](/cli/supervisor/status.md)
- [`pitchfork supervisor stop`](/cli/supervisor/stop.md)
- [`pitchfork usage`](/cli/usage.md)
- [`pitchfork wait`](/cli/wait.md)
3 changes: 3 additions & 0 deletions docs/cli/list.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# `pitchfork list`

- **Usage**: `pitchfork list`
- **Aliases**: `ls`

List all daemons
1 change: 1 addition & 0 deletions docs/cli/logs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# `pitchfork logs`

- **Usage**: `pitchfork logs [-n <N>] [-t --tail] [NAME]...`
- **Aliases**: `l`

Displays logs for daemon(s)

Expand Down
3 changes: 3 additions & 0 deletions docs/cli/remove.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# `pitchfork remove`

- **Usage**: `pitchfork remove`
- **Aliases**: `rm`

Remove a daemon from pitchfork.toml
1 change: 1 addition & 0 deletions docs/cli/run.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# `pitchfork run`

- **Usage**: `pitchfork run [-f --force] <NAME> [CMD]...`
- **Aliases**: `r`

Runs a one-off daemon

Expand Down
1 change: 1 addition & 0 deletions docs/cli/start.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# `pitchfork start`

- **Usage**: `pitchfork start [NAME]...`
- **Aliases**: `s`

Starts a daemon from a pitchfork.toml file

Expand Down
3 changes: 3 additions & 0 deletions docs/cli/status.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# `pitchfork status`

- **Usage**: `pitchfork status`
- **Aliases**: `stat`

Display the status of a daemons
3 changes: 3 additions & 0 deletions docs/cli/stop.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# `pitchfork stop`

- **Usage**: `pitchfork stop`
- **Aliases**: `kill`

Kill a running daemon
7 changes: 0 additions & 7 deletions docs/cli/usage.md

This file was deleted.

5 changes: 5 additions & 0 deletions docs/cli/wait.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# `pitchfork wait`

- **Usage**: `pitchfork wait`
- **Aliases**: `w`

Wait for a daemon to stop, tailing the logs along the way

Exits with the same status code as the daemon
44 changes: 34 additions & 10 deletions pitchfork.usage.kdl
Original file line number Diff line number Diff line change
@@ -1,33 +1,52 @@
name "pitchfork-cli"
bin "pitchfork"
usage "Usage: pitchfork-cli <COMMAND>"
cmd "add"
cmd "clean"
cmd "add" help="Add a new daemon to pitchfork.toml" {
alias "a"
}
cmd "clean" help="Removes stopped/failed daemons from `pitchfork list`" {
alias "c"
}
cmd "completion" {
arg "<SHELL>" help="The shell to generate completion for"
}
cmd "disable"
cmd "enable"
cmd "list"
cmd "disable" help="Prevent a daemon from restarting" {
alias "d"
}
cmd "enable" help="Allow a daemon to start" {
alias "e"
}
cmd "list" help="List all daemons" {
alias "ls"
}
cmd "logs" help="Displays logs for daemon(s)" {
alias "l"
flag "-n" help="Show N lines of logs" {
long_help "Show N lines of logs\n\nSet to 0 to show all logs"
arg "<N>"
}
flag "-t --tail" help="Show logs in real-time"
arg "[NAME]..." help="Show only logs for the specified daemon(s)" var=true
}
cmd "remove"
cmd "remove" help="Remove a daemon from pitchfork.toml" {
alias "rm"
}
cmd "run" help="Runs a one-off daemon" {
alias "r"
flag "-f --force"
arg "<NAME>" help="Name of the daemon to run"
arg "[CMD]..." var=true
}
cmd "start" help="Starts a daemon from a pitchfork.toml file" {
alias "s"
arg "[NAME]..." help="Name of the daemon(s) in pitchfork.toml to start" var=true
}
cmd "status"
cmd "stop"
cmd "status" help="Display the status of a daemons" {
alias "stat"
}
cmd "stop" help="Kill a running daemon" {
alias "kill"
}
cmd "supervisor" subcommand_required=true {
cmd "run" help="Runs the internal pitchfork daemon in the foreground" {
flag "-f --force" help="kill existing daemon"
Expand All @@ -38,10 +57,15 @@ cmd "supervisor" subcommand_required=true {
cmd "status" help="Gets the status of the pitchfork daemon"
cmd "stop" help="Stops the internal pitchfork daemon running in the background"
}
cmd "usage" help="Generates a usage spec for the CLI" {
cmd "usage" hide=true help="Generates a usage spec for the CLI" {
long_help r"Generates a usage spec for the CLI

https://usage.jdx.dev"
}
cmd "wait"
cmd "wait" help="Wait for a daemon to stop, tailing the logs along the way" {
alias "w"
long_help r"Wait for a daemon to stop, tailing the logs along the way

Exits with the same status code as the daemon"
}

3 changes: 2 additions & 1 deletion src/cli/add.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::Result;

/// Add a new daemon to pitchfork.toml
#[derive(Debug, clap::Args)]
#[clap()]
#[clap(visible_alias = "a", verbatim_doc_comment)]
pub struct Add {}

impl Add {
Expand Down
3 changes: 2 additions & 1 deletion src/cli/clean.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::Result;

/// Removes stopped/failed daemons from `pitchfork list`
#[derive(Debug, clap::Args)]
#[clap()]
#[clap(visible_alias = "c", verbatim_doc_comment)]
pub struct Clean {}

impl Clean {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Completion {
&self.shell,
"pitchfork",
"--usage-cmd",
"pitchfork --usage",
"pitchfork usage",
)
.run()
.into_diagnostic()?;
Expand Down
3 changes: 2 additions & 1 deletion src/cli/disable.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::Result;

/// Prevent a daemon from restarting
#[derive(Debug, clap::Args)]
#[clap()]
#[clap(visible_alias = "d", verbatim_doc_comment)]
pub struct Disable {}

impl Disable {
Expand Down
3 changes: 2 additions & 1 deletion src/cli/enable.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::Result;

/// Allow a daemon to start
#[derive(Debug, clap::Args)]
#[clap()]
#[clap(visible_alias = "e", verbatim_doc_comment)]
pub struct Enable {}

impl Enable {
Expand Down
Loading

0 comments on commit d17647a

Please sign in to comment.