4 Commits

Author SHA1 Message Date
323ddea27e f it 2026-03-08 09:47:59 -06:00
1bea4d30ef from inhome 2026-03-08 09:44:50 -06:00
Bel LaPointe
213ee60807 4 files i am a mastor 2026-02-11 17:23:12 -08:00
Bel LaPointe
1c89507497 split into 3 files by... declaring them all in main 2026-02-11 17:21:04 -08:00
13 changed files with 37 additions and 59 deletions

View File

@@ -5,8 +5,8 @@ import (
"io/ioutil"
"os"
"gitea.bel.blue/gogs/pttodo/pttodo"
"github.com/google/uuid"
"gitea.inhome.blapointe.com/gogs/pttodo/pttodo"
"gopkg.in/yaml.v2"
)

View File

@@ -4,7 +4,7 @@ import (
"io"
"os"
"gitea.inhome.blapointe.com/gogs/pttodo/pttodo"
"gitea.bel.blue/gogs/pttodo/pttodo"
"gopkg.in/yaml.v2"
)

View File

@@ -12,7 +12,7 @@ import (
"syscall"
"time"
"gitea.inhome.blapointe.com/gogs/pttodo/pttodo"
"gitea.bel.blue/gogs/pttodo/pttodo"
"github.com/google/uuid"
"gopkg.in/yaml.v2"
)
@@ -204,7 +204,7 @@ func vimd(d string) error {
if err != nil {
return err
}
args := []string{editorbin, "-p"}
args := []string{editorbin, "--noplugin", "-p"}
files, err := listDir(d)
if err != nil {
return err

View File

@@ -1,13 +0,0 @@
module pttodo-cli
go 1.21
require (
gitea.inhome.blapointe.com/gogs/pttodo v0.0.0-20231109151914-5d74b458d542
github.com/google/uuid v1.3.0
gopkg.in/yaml.v2 v2.4.0
)
require github.com/robfig/cron/v3 v3.0.1 // indirect
replace gogs.inhome.blapointe.com/gogs/pttodo => ./..

View File

@@ -1,10 +0,0 @@
gitea.inhome.blapointe.com/gogs/pttodo v0.0.0-20231109151914-5d74b458d542 h1:eOWrA2hEQoyu413vbdXbEXHLXEX2TVBXjWawlWndFhg=
gitea.inhome.blapointe.com/gogs/pttodo v0.0.0-20231109151914-5d74b458d542/go.mod h1:9CFZf/SSod0Z/8WvbmOI4gEzy6xGpBQAq8coVNncNvk=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

View File

@@ -3,6 +3,7 @@
cd "$(dirname "$BASH_SOURCE")"
binary_name="$(head -n 1 go.mod | awk '{print $NF}' | sed 's/.*\///')"
binary_name=pttodo-cli
git_commit="$((
git rev-list -1 HEAD
if git diff | grep . > /dev/null; then

View File

@@ -10,7 +10,7 @@ import (
"slices"
"gitea.inhome.blapointe.com/gogs/pttodo/pttodo"
"gitea.bel.blue/gogs/pttodo/pttodo"
"gopkg.in/yaml.v2"
)

3
go.mod
View File

@@ -1,8 +1,9 @@
module gitea.inhome.blapointe.com/gogs/pttodo
module gitea.bel.blue/gogs/pttodo
go 1.21
require (
github.com/google/uuid v1.6.0
github.com/robfig/cron/v3 v3.0.1
gopkg.in/yaml.v2 v2.4.0
)

2
go.sum
View File

@@ -1,3 +1,5 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=

17
pttodoest/src/deltas.rs Normal file
View File

@@ -0,0 +1,17 @@
pub fn new(added: String, add_schedule: Option<String>) -> serde_yaml::Value {
match add_schedule.clone() {
None => new_add(added),
Some(add_schedule) => new_add_with_schedule(added, add_schedule),
}
}
fn new_add(added: String) -> serde_yaml::Value {
serde_yaml::Value::String(added)
}
fn new_add_with_schedule(added: String, schedule: String) -> serde_yaml::Value {
let mut m = serde_yaml::Mapping::new();
m.insert("schedule".into(), schedule.into());
m.insert("do".into(), added.into());
serde_yaml::Value::Mapping(m)
}

View File

@@ -1,3 +1,5 @@
use crate::tests as tests_pkg;
use clap::Parser;
use serde::{Deserialize, Serialize};
use serde_yaml;
@@ -70,7 +72,7 @@ mod test_flags {
#[test]
fn test_flags_files_unhidden_only() {
tests::with_dir(|d| {
tests_pkg::with_dir(|d| {
std::fs::File::create(d.path().join("plain")).unwrap();
std::fs::File::create(d.path().join(".hidden")).unwrap();
@@ -86,11 +88,3 @@ mod test_flags {
});
}
}
mod tests {
use super::*;
pub fn with_dir(mut foo: impl FnMut(tempdir::TempDir)) {
foo(tempdir::TempDir::new("").unwrap());
}
}

View File

@@ -1,5 +1,8 @@
use crate::deltas as deltas_pkg;
use crate::flags as flags_pkg;
mod deltas;
mod flags;
mod tests;
pub fn main() {
let flags = flags_pkg::Flags::new().expect("failed to flags");
@@ -26,7 +29,7 @@ pub fn main() {
}
fn add(files: Vec<String>, added: String, add_schedule: Option<String>) -> Result<(), String> {
let task = Delta::new(added, add_schedule);
let task = deltas::new(added, add_schedule);
Err(format!("append {:?} to {:?}", &task, &files))
}
@@ -43,26 +46,6 @@ fn dump(files: Vec<String>) -> Result<(), String> {
Err("not impl".to_string())
}
mod Delta {
pub fn new(added: String, add_schedule: Option<String>) -> serde_yaml::Value {
match add_schedule.clone() {
None => new_add(added),
Some(add_schedule) => new_add_with_schedule(added, add_schedule),
}
}
fn new_add(added: String) -> serde_yaml::Value {
serde_yaml::Value::String(added)
}
fn new_add_with_schedule(added: String, schedule: String) -> serde_yaml::Value {
let mut m = serde_yaml::Mapping::new();
m.insert("schedule".into(), schedule.into());
m.insert("do".into(), added.into());
serde_yaml::Value::Mapping(m)
}
}
/*
mod v1 {
use clap::Parser;

3
pttodoest/src/tests.rs Normal file
View File

@@ -0,0 +1,3 @@
pub fn with_dir(mut foo: impl FnMut(tempdir::TempDir)) {
foo(tempdir::TempDir::new("").unwrap());
}