aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ts
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-11 13:02:48 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-11 13:02:48 +0200
commita083d837766f28ddee6d61046f3a100570066afa (patch)
tree9bd42d608de2867f4932cc20eda08d588af1feac /pkgs/by-name/ts
parentpkgs/tskm: Port to qutebrowser (diff)
downloadnixos-config-a083d837766f28ddee6d61046f3a100570066afa.zip
pkgs/tskm/neorg/task: Correctly call the id argument “task”
Diffstat (limited to 'pkgs/by-name/ts')
-rw-r--r--pkgs/by-name/ts/tskm/src/cli.rs4
-rw-r--r--pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs24
2 files changed, 15 insertions, 13 deletions
diff --git a/pkgs/by-name/ts/tskm/src/cli.rs b/pkgs/by-name/ts/tskm/src/cli.rs
index 262fdd60..9175cd3d 100644
--- a/pkgs/by-name/ts/tskm/src/cli.rs
+++ b/pkgs/by-name/ts/tskm/src/cli.rs
@@ -94,8 +94,8 @@ pub enum NeorgCommand {
/// Open the `neorg` project associated with id of the task.
Task {
/// The working set id of the task
- #[arg(value_parser = task_from_working_set_id, add = ArgValueCompleter::new(complete_task_id))]
- id: task::Task,
+ #[arg(value_name = "ID", value_parser = task_from_working_set_id, add = ArgValueCompleter::new(complete_task_id))]
+ task: task::Task,
},
}
diff --git a/pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs b/pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs
index 194e3926..264ac165 100644
--- a/pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs
+++ b/pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs
@@ -10,19 +10,19 @@
use std::{
env,
- fs::{self, File, OpenOptions, read_to_string},
+ fs::{self, read_to_string, File, OpenOptions},
io::Write,
process::Command,
};
-use anyhow::{Context, Result, bail};
+use anyhow::{bail, Context, Result};
use crate::{cli::NeorgCommand, state::State};
pub fn handle(command: NeorgCommand, state: &mut State) -> Result<()> {
match command {
- NeorgCommand::Task { id } => {
- let project = id.project(state)?;
+ NeorgCommand::Task { task } => {
+ let project = task.project(state)?;
let base = dirs::data_local_dir()
.expect("This should exists")
.join("tskm/notes");
@@ -40,15 +40,17 @@ pub fn handle(command: NeorgCommand, state: &mut State) -> Result<()> {
String::new()
};
- if !contents.contains(format!("% {}", id.uuid()).as_str()) {
+ if !contents.contains(format!("% {}", task.uuid()).as_str()) {
let mut options = OpenOptions::new();
options.append(true).create(false);
let mut file = options.open(&path)?;
- file.write_all(format!("* TITLE (% {})", id.uuid()).as_bytes())
- .with_context(|| {
- format!("Failed to write task uuid to file: '{}'", path.display())
- })?;
+ file.write_all(
+ format!("* TITLE (% {})", task.uuid()).as_bytes(),
+ )
+ .with_context(|| {
+ format!("Failed to write task uuid to file: '{}'", path.display())
+ })?;
file.flush()
.with_context(|| format!("Failed to flush file: '{}'", path.display()))?;
}
@@ -59,7 +61,7 @@ pub fn handle(command: NeorgCommand, state: &mut State) -> Result<()> {
.args([
path.to_str().expect("Should be a utf-8 str"),
"-c",
- format!("/% {}", id.uuid()).as_str(),
+ format!("/% {}", task.uuid()).as_str(),
])
.status()?;
if !status.success() {
@@ -90,7 +92,7 @@ pub fn handle(command: NeorgCommand, state: &mut State) -> Result<()> {
}
{
- id.mark_neorg_data(state)?;
+ task.mark_neorg_data(state)?;
}
}
}