-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
71 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# `pitchfork start` | ||
|
||
- **Usage**: `pitchfork start [NAME]...` | ||
- **Usage**: `pitchfork start [ID]...` | ||
- **Aliases**: `s` | ||
|
||
Starts a daemon from a pitchfork.toml file | ||
|
||
## Arguments | ||
|
||
### `[NAME]...` | ||
### `[ID]...` | ||
|
||
Name of the daemon(s) in pitchfork.toml to start | ||
ID of the daemon(s) in pitchfork.toml to start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
#[derive(Debug, serde::Serialize, serde::Deserialize)] | ||
use crate::daemon_status::DaemonStatus; | ||
use std::fmt::Display; | ||
|
||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | ||
pub struct Daemon { | ||
pub run: String, | ||
pub id: String, | ||
pub title: Option<String>, | ||
pub pid: Option<u32>, | ||
pub status: DaemonStatus, | ||
} | ||
|
||
impl Display for Daemon { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "{}", self.id) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, strum::Display, strum::EnumIs)] | ||
#[strum(serialize_all = "snake_case")] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum DaemonStatus { | ||
Failed(String), | ||
Waiting, | ||
Running, | ||
Errored(Option<i32>), | ||
Stopped, | ||
} | ||
|
||
impl DaemonStatus { | ||
pub fn style(&self) -> String { | ||
let s = self.to_string(); | ||
match self { | ||
DaemonStatus::Failed(_) => console::style(s).red().to_string(), | ||
DaemonStatus::Waiting => console::style(s).yellow().to_string(), | ||
DaemonStatus::Running => console::style(s).green().to_string(), | ||
DaemonStatus::Stopped => console::style(s).dim().to_string(), | ||
DaemonStatus::Errored(_) => console::style(s).red().to_string(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ extern crate log; | |
|
||
mod cli; | ||
mod daemon; | ||
mod daemon_status; | ||
mod env; | ||
mod ipc; | ||
mod logger; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters