Skip to main content

Commands

Enum Commands 

Source
pub enum Commands {
    Run {
        host: HostArg,
        cwd: Option<String>,
        max_secs: Option<u64>,
        wait: bool,
        no_tail: bool,
        cmd: Vec<String>,
    },
    Poll {
        id: JobId,
        host: HostArg,
        json: bool,
    },
    Wait {
        id: JobId,
        host: HostArg,
        timeout: Option<u64>,
    },
    Tail {
        id: JobId,
        host: HostArg,
        follow: bool,
        all: bool,
        lines: Option<u64>,
    },
    Ls {
        host: HostArg,
        all: bool,
        json: bool,
        full: bool,
    },
    Kill {
        id: JobId,
        host: HostArg,
        rm: bool,
    },
    Rm {
        id: Option<JobId>,
        all: bool,
        host: HostArg,
    },
    Host(HostCmd),
}

Variants§

§

Run

Dispatch a command and print its job id

Fields

§host: HostArg
§cwd: Option<String>

Directory to run in (default: the host’s default_cwd, else $HOME)

§max_secs: Option<u64>

Kill the remote job after S seconds (0 means unbounded)

§wait: bool

Block locally until the job finishes; unlike –max-secs, this does not kill it

§no_tail: bool

With –wait: print the log once at the end instead of streaming

§cmd: Vec<String>

The command to run.

Everything after the first word is part of the command, so coop’s own flags go BEFORE it: coop run --wait ls, not coop run ls --wait. Use -- when the command takes flags coop also has: coop run -- ls --all.

stdout and stderr are merged into one log, in the order the job wrote them; redirect inside your command to separate them.

Do NOT pipe the command into head or tail to keep the log small. rc becomes the pipe’s – measured: sh -c 'echo x; exit 1' | tail -3 exits 0 – so a failed job reports success and any && after it runs anyway, and rc is the artifact coop’s whole design rests on. Let the job be the work and let coop shape the output: coop tail <id> -n 3, or plain coop tail <id>, which already caps the read at 64KB. If your remote sh supports it, set -o pipefail keeps a genuine pipeline honest; it is not portable POSIX, so coop does not add it for you – the command is yours.

§

Poll

Print state, but no job output; prints nothing from the job; use coop tail

What coop tail gives you is one log: stdout and stderr are merged into one log, in the order the job wrote them; redirect inside your command to separate them.

Fields

§host: HostArg
§json: bool
§

Wait

Block until done; prints nothing; use coop tail

What coop tail gives you is one log: stdout and stderr are merged into one log, in the order the job wrote them; redirect inside your command to separate them.

Fields

§host: HostArg
§timeout: Option<u64>

Stop waiting locally after S seconds; the remote job keeps running

§

Tail

Print a job’s merged stdout and stderr as raw bytes

stdout and stderr are merged into one log, in the order the job wrote them; redirect inside your command to separate them. There is one artifact per job on purpose: splitting it would mean two files, two probe offsets, and a lost interleaving, to serve a case a redirect in your own command already covers.

Fields

§id: JobId

The job whose log to print.

§host: HostArg
§follow: bool

Follow until the job finishes

§all: bool

Print the whole log instead of the last 64KB

§lines: Option<u64>

Print the last N lines instead of the last 64KB

§

Ls

List jobs

The human table collapses whitespace and truncates commands to keep one job on one scannable line. Use –full to read a long command, –json for the machine surface.

Fields

§host: HostArg
§all: bool

Include finished jobs older than the default 24-hour window

§json: bool

Emit machine-readable rows with complete, unmodified commands

§full: bool

Print each command in full instead of truncating it to fit one line

The table shortens a long command so one job stays one scannable row. This prints the whole thing, for reading rather than scanning; --json remains the machine surface.

§

Kill

Kill a running job

Fields

§host: HostArg
§rm: bool

Drop the job’s state directory too, in the same round trip

kill then rm is the common pair – ending a job you did not mean to start usually means discarding its output as well. Doing both here costs one ssh call instead of two on a capped channel.

§

Rm

Drop a job’s state directory

Fields

§id: Option<JobId>

The job to remove. Omit with –all.

§all: bool

Remove every FINISHED job, ignoring keep_days.

Running jobs and orphans are kept: --all never stops work, and an orphan is evidence rather than mud. Use coop rm <id> or coop kill to end a named job.

§host: HostArg
§

Host(HostCmd)

Inspect configured hosts

Trait Implementations§

Source§

impl Debug for Commands

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for Commands

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Subcommand for Commands

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.