first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use clap::{Args, Subcommand, ValueEnum};
|
||||
|
||||
use crate::SortOrderArg;
|
||||
use crate::date_time::parse_rfc3339;
|
||||
use crate::json_filter::JsonOutput;
|
||||
|
||||
/// Task-related subcommands.
|
||||
@@ -18,6 +20,17 @@ pub enum TaskCommand {
|
||||
Message(MessageCommand),
|
||||
}
|
||||
|
||||
impl TaskCommand {
|
||||
pub(crate) fn as_str_for_tracing(&self) -> &'static str {
|
||||
match self {
|
||||
TaskCommand::List(_) => "run list",
|
||||
TaskCommand::Get(_) => "run get",
|
||||
TaskCommand::Conversation(_) => "run conversation",
|
||||
TaskCommand::Message(_) => "run message",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Conversation-related subcommands.
|
||||
#[derive(Debug, Clone, Subcommand)]
|
||||
pub enum ConversationCommand {
|
||||
@@ -141,8 +154,8 @@ pub struct ListTasksArgs {
|
||||
#[arg(long = "environment", value_name = "ENV_ID")]
|
||||
pub environment: Option<String>,
|
||||
|
||||
/// Filter by skill specification (e.g. `owner/repo:path/to/SKILL.md`).
|
||||
#[arg(long = "skill", value_name = "SPEC")]
|
||||
/// Filter by skill (e.g. `owner/repo:path/to/SKILL.md`).
|
||||
#[arg(long = "skill", value_name = "SKILL")]
|
||||
pub skill: Option<String>,
|
||||
|
||||
/// Filter to runs created by a specific scheduled agent.
|
||||
@@ -187,7 +200,7 @@ pub struct ListTasksArgs {
|
||||
|
||||
/// Sort direction.
|
||||
#[arg(long = "sort-order", value_enum, value_name = "DIR")]
|
||||
pub sort_order: Option<RunSortOrderArg>,
|
||||
pub sort_order: Option<SortOrderArg>,
|
||||
|
||||
/// Opaque pagination cursor from a previous list response.
|
||||
///
|
||||
@@ -201,13 +214,6 @@ pub struct ListTasksArgs {
|
||||
pub json_output: JsonOutput,
|
||||
}
|
||||
|
||||
/// Parse an RFC 3339 timestamp into a UTC `DateTime`.
|
||||
fn parse_rfc3339(s: &str) -> Result<DateTime<Utc>, String> {
|
||||
DateTime::parse_from_rfc3339(s)
|
||||
.map(|dt| dt.with_timezone(&Utc))
|
||||
.map_err(|e| format!("invalid RFC 3339 timestamp '{s}': {e}"))
|
||||
}
|
||||
|
||||
/// Run state values accepted by `--state`. Repeatable; multiple values match any of them.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
|
||||
pub enum RunStateArg {
|
||||
@@ -289,15 +295,6 @@ pub enum RunSortByArg {
|
||||
Agent,
|
||||
}
|
||||
|
||||
/// Sort-order values accepted by `--sort-order`.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
|
||||
pub enum RunSortOrderArg {
|
||||
#[value(name = "asc")]
|
||||
Asc,
|
||||
#[value(name = "desc")]
|
||||
Desc,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Args)]
|
||||
pub struct TaskGetArgs {
|
||||
/// The task ID to get status for.
|
||||
|
||||
Reference in New Issue
Block a user