From ed1276c7008b1dab96cd6b73e4b0fb62ca58bcc0 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 24 Aug 2021 10:44:14 +0300 Subject: feat! rename binary from jt2 to jt The software has now replaced all my use of the old Python version. Sponsored-by: author --- Cargo.lock | 180 +++++++++++++++++++++++++++++++++++++------------------ Cargo.toml | 2 +- debian/changelog | 2 +- debian/control | 4 +- debian/copyright | 2 +- debian/rules | 4 +- jt.md | 66 ++++++++++---------- src/bin/jt.rs | 29 +++++++++ src/bin/jt2.rs | 29 --------- src/config.rs | 2 +- subplot/jt.py | 2 +- 11 files changed, 194 insertions(+), 128 deletions(-) create mode 100644 src/bin/jt.rs delete mode 100644 src/bin/jt2.rs diff --git a/Cargo.lock b/Cargo.lock index 9ea5edc..8217944 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" +checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf" [[package]] name = "atty" @@ -45,9 +45,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" @@ -72,9 +72,9 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" dependencies = [ "memchr", ] @@ -127,11 +127,10 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" dependencies = [ - "autocfg", "cfg-if", "lazy_static", ] @@ -208,9 +207,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if", "libc", @@ -225,9 +224,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "globset" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" +checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" dependencies = [ "aho-corasick", "bstr", @@ -247,20 +246,26 @@ dependencies = [ "walkdir", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + [[package]] name = "heck" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] @@ -276,9 +281,9 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b287fb45c60bb826a0dc68ff08742b9d88a2fea13d6e0c286b3172065aaf878c" +checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" dependencies = [ "crossbeam-utils", "globset", @@ -292,14 +297,24 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "indexmap" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +dependencies = [ + "autocfg", + "hashbrown", +] + [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] -name = "jt2" +name = "jt" version = "0.1.0" dependencies = [ "anyhow", @@ -324,9 +339,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.93" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" +checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5" [[package]] name = "linked-hash-map" @@ -351,9 +366,9 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "memchr" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "num-integer" @@ -376,9 +391,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "opaque-debug" @@ -465,9 +480,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" +checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" dependencies = [ "unicode-xid", ] @@ -489,9 +504,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.5" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ "bitflags", ] @@ -540,18 +555,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.125" +version = "1.0.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.125" +version = "1.0.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +checksum = "e57ae87ad533d9a56427558b516d0adac283614e347abf85b0dc0cbbf0a249f3" dependencies = [ "proc-macro2", "quote", @@ -560,9 +575,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" dependencies = [ "itoa", "ryu", @@ -571,12 +586,12 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" +checksum = "6375dbd828ed6964c3748e4ef6d18e7a175d408ffe184bca01698d0c73f915a9" dependencies = [ "dtoa", - "linked-hash-map", + "indexmap", "serde", "yaml-rust", ] @@ -601,9 +616,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" +checksum = "69b041cdcb67226aca307e6e7be44c8806423d83e018bd662360a93dabce4d71" dependencies = [ "clap", "lazy_static", @@ -612,9 +627,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" +checksum = "7813934aecf5f51a54775e00068c237de98489463968231a51746bbbc03f9c10" dependencies = [ "heck", "proc-macro-error", @@ -625,9 +640,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.69" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb" +checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" dependencies = [ "proc-macro2", "quote", @@ -636,9 +651,9 @@ dependencies = [ [[package]] name = "tera" -version = "1.7.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cb278a72e426f291faf182cb0e0cb7d20241e8e9881046724ac874a83c62346" +checksum = "bf95b0d8a46da5fe3ea119394a6c7f1e745f9de359081641c99946e2bf55d4f2" dependencies = [ "globwalk", "lazy_static", @@ -647,6 +662,7 @@ dependencies = [ "regex", "serde", "serde_json", + "unic-segment", ] [[package]] @@ -669,18 +685,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" dependencies = [ "proc-macro2", "quote", @@ -718,11 +734,61 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" +dependencies = [ + "unic-ucd-segment", +] + +[[package]] +name = "unic-ucd-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + [[package]] name = "unicode-segmentation" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" @@ -732,9 +798,9 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "vec_map" diff --git a/Cargo.toml b/Cargo.toml index 98ec949..c408230 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "jt2" +name = "jt" version = "0.1.0" authors = ["Lars Wirzenius "] edition = "2018" diff --git a/debian/changelog b/debian/changelog index ec6edc0..d1a3b83 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -jt2 (0.1.0-1) UNRELEASED; urgency=medium +jt (0.1.0-1) UNRELEASED; urgency=medium * Initial packaging. This is not intended to be uploaded to Debian, so no closing of an ITP bug. diff --git a/debian/control b/debian/control index 85c7d40..336dd98 100644 --- a/debian/control +++ b/debian/control @@ -1,4 +1,4 @@ -Source: jt2 +Source: jt Maintainer: Lars Wirzenius Section: misc Priority: optional @@ -16,7 +16,7 @@ Build-Depends: texlive-latex-recommended Homepage: https://jt2.liw.fi -Package: jt2 +Package: jt Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Built-Using: ${cargo:Built-Using} diff --git a/debian/copyright b/debian/copyright index 7ee7188..9bf2a22 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,5 +1,5 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: jt2 +Upstream-Name: jt Upstream-Contact: Lars Wirzenius Source: http://git.liw.fi/jt2 diff --git a/debian/rules b/debian/rules index 2aece9a..e80a0aa 100755 --- a/debian/rules +++ b/debian/rules @@ -7,8 +7,8 @@ override_dh_auto_build: true override_dh_auto_install: - cargo install --path=. --root=debian/jt2 - find debian/jt2 -name '.crates*' -delete + cargo install --path=. --root=debian/jt + find debian/jt -name '.crates*' -delete override_dh_auto_test: ./check diff --git a/jt.md b/jt.md index 9c561da..c32ea62 100644 --- a/jt.md +++ b/jt.md @@ -46,8 +46,8 @@ correctly. ~~~scenario given an installed jt -when I run jt2 config -then stdout matches regex dirname:.*/\.local.share/jt2 +when I run jt config +then stdout matches regex dirname:.*/\.local.share/jt then stdout matches regex editor: "/usr/bin/editor" ~~~ @@ -55,7 +55,7 @@ then stdout matches regex editor: "/usr/bin/editor" ~~~scenario given an installed jt -when I try to run jt2 --config does-not-exist config +when I try to run jt --config does-not-exist config then command fails then stderr contains "does-not-exist" ~~~ @@ -65,8 +65,8 @@ then stderr contains "does-not-exist" ~~~scenario given an installed jt given file empty.yaml -when I run jt2 --config empty.yaml config -then stdout matches regex dirname:.*/\.local.share/jt2 +when I run jt --config empty.yaml config +then stdout matches regex dirname:.*/\.local.share/jt then stdout matches regex editor: "/usr/bin/editor" ~~~ @@ -82,7 +82,7 @@ user's home directory. ~~~scenario given an installed jt given file config.yaml -when I run jt2 --config config.yaml config +when I run jt --config config.yaml config then stdout matches regex dirname:.*/.*/journal then stdout matches regex editor: "emacs" ~~~ @@ -97,7 +97,7 @@ editor: emacs ~~~scenario given an installed jt given file config.yaml -when I run jt2 --config config.yaml --dirname xxx --editor yyy config +when I run jt --config config.yaml --dirname xxx --editor yyy config then stdout matches regex dirname: "xxx" then stdout matches regex editor: "yyy" ~~~ @@ -109,7 +109,7 @@ then stdout matches regex editor: "yyy" ~~~scenario given an installed jt given file toomuch.yaml -when I try to run jt2 --config toomuch.yaml config +when I try to run jt --config toomuch.yaml config then command fails then stderr contains "unknown_field" ~~~ @@ -127,15 +127,15 @@ using the tool. ~~~scenario given an installed jt -when I run jt2 --dirname jrnl init default "My test journal" +when I run jt --dirname jrnl init default "My test journal" then command is successful and directory jrnl exists then there are no uncommitted changes in jrnl -when I run jt2 --dirname jrnl is-journal +when I run jt --dirname jrnl is-journal then command is successful -when I try to run jt2 --dirname bogus is-journal +when I try to run jt --dirname bogus is-journal then command fails ~~~ @@ -147,26 +147,26 @@ Verify that we can create a new draft entry for the journal. ~~~scenario given an installed jt -when I run jt2 --dirname jrnl init default "My test journal" +when I run jt --dirname jrnl init default "My test journal" then command is successful and there are no drafts in jrnl and there are no journal entries in jrnl -when I run jt2 --editor=none --dirname=jrnl new "Abracadabra" +when I run jt --editor=none --dirname=jrnl new "Abracadabra" then command is successful and there is one draft in jrnl and draft 0 in jrnl contains "Abracadabra" and draft 0 in jrnl contains "!meta date=" -when I run jt2 --dirname=jrnl list +when I run jt --dirname=jrnl list then stdout matches regex ^0 Abracadabra$ given an executable script append.sh -when I run jt2 --editor=./append.sh --dirname=jrnl edit 0 +when I run jt --editor=./append.sh --dirname=jrnl edit 0 then command is successful and draft 0 in jrnl contains "Open sesame!" -when I run jt2 --dirname=jrnl finish 0 abra +when I run jt --dirname=jrnl finish 0 abra then command is successful and there is one journal entry in jrnl, at FILE and file name ends with .mdwn @@ -189,36 +189,36 @@ Verify that we can create two draft entries at the same time. ~~~scenario given an installed jt -when I run jt2 --dirname jrnl init default "My test journal" +when I run jt --dirname jrnl init default "My test journal" then command is successful then there are no drafts in jrnl then there are no journal entries in jrnl -when I run jt2 --editor=none --dirname=jrnl new "Abracadabra" +when I run jt --editor=none --dirname=jrnl new "Abracadabra" then command is successful then there is one draft in jrnl then draft 0 in jrnl contains "Abracadabra" -when I run jt2 --editor=none --dirname=jrnl new "Simsalabim" +when I run jt --editor=none --dirname=jrnl new "Simsalabim" then command is successful then there are two drafts in jrnl then draft 0 in jrnl contains "Abracadabra" then draft 1 in jrnl contains "Simsalabim" given an executable script append.sh -when I run jt2 --editor=./append.sh --dirname=jrnl edit 0 +when I run jt --editor=./append.sh --dirname=jrnl edit 0 then draft 0 in jrnl contains "Open sesame!" -when I run jt2 --editor=./append.sh --dirname=jrnl edit 1 +when I run jt --editor=./append.sh --dirname=jrnl edit 1 then draft 1 in jrnl contains "Open sesame!" -when I run jt2 --dirname=jrnl finish 0 abra +when I run jt --dirname=jrnl finish 0 abra then command is successful then there is one journal entry in jrnl, at FILE then journal entry contains "Abracadabra" then journal entry contains "Open sesame!" then there is one draft in jrnl -when I run jt2 --dirname=jrnl finish 1 sim +when I run jt --dirname=jrnl finish 1 sim then command is successful then there are two journal entries in jrnl, at FILE1 and FILE2 then journal entry contains "Abracadabra" @@ -238,23 +238,23 @@ Verify that we can remove a draft, and then create a new one. ~~~scenario given an installed jt -when I run jt2 --dirname jrnl init default "My test journal" +when I run jt --dirname jrnl init default "My test journal" then command is successful and there are no drafts in jrnl and there are no journal entries in jrnl -when I run jt2 --editor=none --dirname=jrnl new "Hulabaloo" +when I run jt --editor=none --dirname=jrnl new "Hulabaloo" then command is successful and there is one draft in jrnl and draft 0 in jrnl contains "Hulabaloo" and draft 0 in jrnl contains "!meta date=" -when I run jt2 --dirname=jrnl remove 0 +when I run jt --dirname=jrnl remove 0 then command is successful and there are no drafts in jrnl and there are no journal entries in jrnl -when I run jt2 --editor=none --dirname=jrnl new "Abracadabra" +when I run jt --editor=none --dirname=jrnl new "Abracadabra" then command is successful and there is one draft in jrnl and draft 0 in jrnl contains "Abracadabra" @@ -268,12 +268,12 @@ Verify that we can have a custom template for new journal entries. ~~~scenario given an installed jt -when I run jt2 --dirname jrnl init default "My test journal" +when I run jt --dirname jrnl init default "My test journal" then command is successful given file jrnl/.config/templates/new_entry from new_entry_template -when I run jt2 --editor=none --dirname=jrnl new "Abracadabra" +when I run jt --editor=none --dirname=jrnl new "Abracadabra" then command is successful and there is one draft in jrnl and draft 0 in jrnl contains "custom new entry template" @@ -291,19 +291,19 @@ to that topic page. ~~~scenario given an installed jt -when I run jt2 --dirname jrnl init default "My test journal" +when I run jt --dirname jrnl init default "My test journal" then command is successful -when I try to run jt2 --editor=none --dirname=jrnl new --topic foo "Abracadabra" +when I try to run jt --editor=none --dirname=jrnl new --topic foo "Abracadabra" then command fails then stderr contains "foo" -when I run jt2 --editor=none --dirname=jrnl new-topic foo "Things about Foo" +when I run jt --editor=none --dirname=jrnl new-topic foo "Things about Foo" then command is successful then file jrnl/foo.mdwn contains "Things about Foo" then there are no uncommitted changes in jrnl -when I run jt2 --editor=none --dirname=jrnl new --topic foo "Abracadabra" +when I run jt --editor=none --dirname=jrnl new --topic foo "Abracadabra" then command is successful and there is one draft in jrnl and draft 0 in jrnl links to "foo" diff --git a/src/bin/jt.rs b/src/bin/jt.rs new file mode 100644 index 0000000..11fc45d --- /dev/null +++ b/src/bin/jt.rs @@ -0,0 +1,29 @@ +use jt::config::Configuration; +use jt::opt::{Opt, SubCommand}; + +use structopt::StructOpt; + +fn main() { + if let Err(err) = do_work() { + eprintln!("ERROR: {:?}", err); + std::process::exit(1); + } +} + +fn do_work() -> anyhow::Result<()> { + pretty_env_logger::init_custom_env("JT_LOG"); + let opt = Opt::from_args(); + let config = Configuration::read(&opt)?; + match opt.cmd { + SubCommand::Config(x) => x.run(&config)?, + SubCommand::Init(x) => x.run(&config)?, + SubCommand::IsJournal(x) => x.run(&config)?, + SubCommand::New(x) => x.run(&config)?, + SubCommand::NewTopic(x) => x.run(&config)?, + SubCommand::List(x) => x.run(&config)?, + SubCommand::Edit(x) => x.run(&config)?, + SubCommand::Remove(x) => x.run(&config)?, + SubCommand::Finish(x) => x.run(&config)?, + } + Ok(()) +} diff --git a/src/bin/jt2.rs b/src/bin/jt2.rs deleted file mode 100644 index a5760d8..0000000 --- a/src/bin/jt2.rs +++ /dev/null @@ -1,29 +0,0 @@ -use jt2::config::Configuration; -use jt2::opt::{Opt, SubCommand}; - -use structopt::StructOpt; - -fn main() { - if let Err(err) = do_work() { - eprintln!("ERROR: {:?}", err); - std::process::exit(1); - } -} - -fn do_work() -> anyhow::Result<()> { - pretty_env_logger::init_custom_env("JT_LOG"); - let opt = Opt::from_args(); - let config = Configuration::read(&opt)?; - match opt.cmd { - SubCommand::Config(x) => x.run(&config)?, - SubCommand::Init(x) => x.run(&config)?, - SubCommand::IsJournal(x) => x.run(&config)?, - SubCommand::New(x) => x.run(&config)?, - SubCommand::NewTopic(x) => x.run(&config)?, - SubCommand::List(x) => x.run(&config)?, - SubCommand::Edit(x) => x.run(&config)?, - SubCommand::Remove(x) => x.run(&config)?, - SubCommand::Finish(x) => x.run(&config)?, - } - Ok(()) -} diff --git a/src/config.rs b/src/config.rs index 655b835..03b54ce 100644 --- a/src/config.rs +++ b/src/config.rs @@ -8,7 +8,7 @@ use serde::Deserialize; use std::default::Default; use std::path::{Path, PathBuf}; -const APP: &str = "jt2"; +const APP: &str = "jt"; // The configuration file we read. // diff --git a/subplot/jt.py b/subplot/jt.py index 5441ac3..dfdf44c 100644 --- a/subplot/jt.py +++ b/subplot/jt.py @@ -65,7 +65,7 @@ def run_jt_finish(ctx, dirname=None): def _binary(name): srcdir = globals()["srcdir"] - return os.path.join(srcdir, "target", "debug", "jt2") + return os.path.join(srcdir, "target", "debug", "jt") def output_contains(ctx, pattern=None): -- cgit v1.2.1 From 0235721852dbddea8a306ba3be1d38a82a9fbb79 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 24 Aug 2021 10:54:27 +0300 Subject: chore: fix unnecessary &foo to foo Thank you, clippy. Sponsored-by: author --- src/template.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/template.rs b/src/template.rs index 41d2e04..cf05ab5 100644 --- a/src/template.rs +++ b/src/template.rs @@ -33,15 +33,15 @@ impl Templates { } pub fn new_draft(&self, context: &Context) -> Result { - self.render("new_entry", &context) + self.render("new_entry", context) } pub fn new_topic(&self, context: &Context) -> Result { - self.render("new_topic", &context) + self.render("new_topic", context) } fn render(&self, name: &str, context: &Context) -> Result { - match self.tera.render(name, &context) { + match self.tera.render(name, context) { Ok(s) => Ok(s), Err(e) => match e.kind { tera::ErrorKind::TemplateNotFound(x) => Err(JournalError::TemplateNotFound(x)), -- cgit v1.2.1