tedi 0.16.3

Personal productivity CLI for task tracking, time management, and GitHub issue integration
Documentation
//! CLI definitions and entry point for blocker commands.
//!
//! This module handles:
//! - CLI argument parsing
//! - Dispatching to the integration module for issue-based blockers

use std::sync::Arc;

use clap::{Args, Subcommand};
use color_eyre::eyre::Result;

use super::clockify::{HaltArgs, ResumeArgs};

#[derive(Clone, Debug, Subcommand)]
pub enum Command {
	/// Append a blocker
	Add {
		name: String,
		/// Nest as a child of the current deepest item
		#[arg(short = 'n', long)]
		nested: bool,
		/// Mark as urgent (adds to owner-level urgent.md)
		#[arg(short = 'u', long)]
		urgent: bool,
	},
	/// Pop the last one
	Pop {
		/// Also pop one parent (can be repeated; `-p -p` pops two parents in addition to current).
		///
		/// Inverse of `add -n`: with `-p` provided N times, removes the current leaf plus its
		/// N nearest ancestors along the chain.
		#[arg(short = 'p', long = "parent", action = clap::ArgAction::Count)]
		parents: u8,
	},
	/// Replace the current (deepest) blocker in-place.
	///
	/// Unlike pop + add, this preserves the item's position in the tree —
	/// useful when the current blocker is the only child of its parent
	/// (where pop + add would un-nest the replacement).
	Set { name: String },
	/// Full list of blockers down from the main task
	List,
	/// Compactly show the last entry
	Current {
		/// Show fully-qualified path with project prepended
		#[arg(short = 'f', long)]
		fully_qualified: bool,
	},
	/// Open issue file with $EDITOR
	Open {
		/// Optional pattern to open a different issue
		pattern: Option<String>,
		/// Set the opened issue as current after exiting the editor
		#[arg(short = 's', long)]
		set_after: bool,
		/// Open the urgent file instead
		#[arg(short = 'u', long)]
		urgent: bool,
	},
	/// Navigate the milestone issue rotation.
	///
	/// No `prev` command — re-arrange the milestone instead, so active tasks naturally float up.
	#[command(subcommand)]
	Move(MoveCommand),
	/// Resume tracking time on the current blocker task via Clockify
	Resume(ResumeArgs),
	/// Pause tracking time via Clockify
	Halt(HaltArgs),
	/// Show the current clockify project name (repo/title)
	CurrentProject,
}
#[derive(Clone, Debug, Subcommand)]
pub enum MoveCommand {
	/// Move to the next issue in the rotation (circular)
	Up,
	/// Move to the previous issue in the rotation (circular)
	Down,
	/// Jump to the first issue matching a pattern (case-insensitive substring on display path).
	/// If omitted, opens fzf on all available issues.
	To { pattern: Option<String> },
}
#[derive(Args, Clone, Debug)]
pub struct BlockerArgs {
	#[command(subcommand)]
	pub command: Command,
}
pub async fn main(args: BlockerArgs, offline: bool, settings: Arc<crate::config::LiveSettings>) -> Result<()> {
	super::integration::main_integrated(args.command, offline, settings).await
}