Compare commits
7 Commits
924f989c05
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
140d5881af | ||
|
|
3d4fd8d048 | ||
|
|
cdc04ab266 | ||
|
|
46aff0e6b1 | ||
|
|
cb99d74b4e | ||
|
|
56176b2659 | ||
|
|
e2ce929698 |
41
Cargo.lock
generated
41
Cargo.lock
generated
@@ -23,6 +23,38 @@ version = "1.0.100"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
|
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "argh"
|
||||||
|
version = "0.1.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34ff18325c8a36b82f992e533ece1ec9f9a9db446bd1c14d4f936bac88fcd240"
|
||||||
|
dependencies = [
|
||||||
|
"argh_derive",
|
||||||
|
"argh_shared",
|
||||||
|
"rust-fuzzy-search",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "argh_derive"
|
||||||
|
version = "0.1.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "adb7b2b83a50d329d5d8ccc620f5c7064028828538bdf5646acd60dc1f767803"
|
||||||
|
dependencies = [
|
||||||
|
"argh_shared",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.114",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "argh_shared"
|
||||||
|
version = "0.1.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a464143cc82dedcdc3928737445362466b7674b5db4e2eb8e869846d6d84f4f6"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atomic"
|
name = "atomic"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
@@ -115,9 +147,10 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chkr"
|
name = "chkr"
|
||||||
version = "0.1.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"argh",
|
||||||
"crossterm",
|
"crossterm",
|
||||||
"insta",
|
"insta",
|
||||||
"ratatui",
|
"ratatui",
|
||||||
@@ -990,6 +1023,12 @@ version = "0.8.8"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rust-fuzzy-search"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a157657054ffe556d8858504af8a672a054a6e0bd9e8ee531059100c0fa11bb2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "chkr"
|
name = "chkr"
|
||||||
version = "0.1.0"
|
version = "0.3.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crossterm = "0.29"
|
crossterm = "0.29"
|
||||||
ratatui = { version = "0.30", features = ["crossterm"] }
|
ratatui = { version = "0.30", features = ["crossterm"] }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
argh = "0.1.13"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = "1.33"
|
insta = "1.33"
|
||||||
|
|||||||
27
scripts/bump.sh
Normal file
27
scripts/bump.sh
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
VERSION="$(git cliff --bumped-version)"
|
||||||
|
VERSION_CLEAN="${VERSION#v}"
|
||||||
|
sed -i "s/^version = \".*\"/version = \"${VERSION_CLEAN}\"/" Cargo.toml
|
||||||
|
cargo check
|
||||||
|
|
||||||
|
echo Press Y to commit version bump to ${VERSION_CLEAN}
|
||||||
|
read -r CONFIRM
|
||||||
|
if [ "${CONFIRM}" != "Y" ]; then
|
||||||
|
echo Aborting
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -am "chore: bump version to ${VERSION}"
|
||||||
|
git tag -am "Version ${VERSION}" "${VERSION}"
|
||||||
|
|
||||||
|
echo Press Y to push commit and tag
|
||||||
|
read -r CONFIRM
|
||||||
|
if [ "${CONFIRM}" != "Y" ]; then
|
||||||
|
echo Aborting
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git push
|
||||||
|
git push --tags
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//! Abstraction around event sourcing for the checklist application.
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use crossterm::event::{self, Event};
|
use crossterm::event::{self, Event};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|||||||
32
src/main.rs
32
src/main.rs
@@ -1,10 +1,10 @@
|
|||||||
/// A simple terminal checklist application.
|
//! A simple terminal checklist application.
|
||||||
mod event_source;
|
mod event_source;
|
||||||
mod terminal_guard;
|
mod terminal_guard;
|
||||||
/// UI components (todo list)
|
|
||||||
mod todo_list;
|
mod todo_list;
|
||||||
|
|
||||||
use anyhow::{Context as _, Result, anyhow, bail};
|
use anyhow::{Context as _, Result, anyhow, bail};
|
||||||
|
use argh::FromArgs;
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use crossterm::event::{self, EnableMouseCapture, Event, KeyCode};
|
use crossterm::event::{self, EnableMouseCapture, Event, KeyCode};
|
||||||
use crossterm::execute;
|
use crossterm::execute;
|
||||||
@@ -17,14 +17,40 @@ use std::io::{self, Read as _};
|
|||||||
use terminal_guard::TerminalModeGuard;
|
use terminal_guard::TerminalModeGuard;
|
||||||
use todo_list::TodoList;
|
use todo_list::TodoList;
|
||||||
|
|
||||||
|
#[derive(FromArgs)]
|
||||||
|
/// chkr - terminal checklist
|
||||||
|
struct Args {
|
||||||
|
/// load checklist from file instead of stdin
|
||||||
|
#[argh(option, short = 'f', long = "file")]
|
||||||
|
file: Option<String>,
|
||||||
|
|
||||||
|
/// print version and exit
|
||||||
|
#[argh(switch, short = 'V', long = "version")]
|
||||||
|
version: bool,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
let args: Args = argh::from_env();
|
||||||
|
|
||||||
|
if args.version {
|
||||||
|
println!("v{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
let input: String = if let Some(path) = args.file {
|
||||||
|
std::fs::read_to_string(&path).with_context(|| format!("reading file {path}"))?
|
||||||
|
} else {
|
||||||
let mut input = String::new();
|
let mut input = String::new();
|
||||||
io::stdin()
|
io::stdin()
|
||||||
.read_to_string(&mut input)
|
.read_to_string(&mut input)
|
||||||
.context("reading stdin")?;
|
.context("reading stdin")?;
|
||||||
|
input
|
||||||
|
};
|
||||||
|
|
||||||
if input.trim().is_empty() {
|
if input.trim().is_empty() {
|
||||||
eprintln!("Provide text via stdin (pipe or heredoc). Example: \n cat file.txt | chkr");
|
eprintln!(
|
||||||
|
"Provide text via stdin (pipe or heredoc), or use --file. Example: \n cat file.txt | chkr"
|
||||||
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//! Todo list UI component for the checklist application.
|
||||||
use ratatui::style::Style;
|
use ratatui::style::Style;
|
||||||
use ratatui::widgets::{Block, Borders, List, ListItem, ListState};
|
use ratatui::widgets::{Block, Borders, List, ListItem, ListState};
|
||||||
// use Frame via the crate root type `ratatui::Frame` in the signature below
|
// use Frame via the crate root type `ratatui::Frame` in the signature below
|
||||||
|
|||||||
Reference in New Issue
Block a user