Compare commits

...

6 commits

Author SHA1 Message Date
Schrottkatze 093fe30d75
fix unused markdown uses 2024-05-06 21:49:22 +02:00
Schrottkatze e64935cf00
fix crane warnings 2024-05-06 21:49:11 +02:00
Schrottkatze a3777bd73a
change editor timeout to 200ms 2024-05-06 21:33:30 +02:00
Schrottkatze 73bbc7c616
jrnl: shorten command and add inquire 2024-05-06 21:33:14 +02:00
Schrottkatze caaa7c7c6b
fix deprecation warnings 2024-05-06 21:32:14 +02:00
Schrottkatze 90d6d6ae85
go lesbian 2024-05-06 21:27:45 +02:00
16 changed files with 251 additions and 56 deletions

87
Cargo.lock generated
View file

@ -127,6 +127,12 @@ version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]] [[package]]
name = "cassowary" name = "cassowary"
version = "0.3.0" version = "0.3.0"
@ -233,6 +239,22 @@ version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
[[package]]
name = "crossterm"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
dependencies = [
"bitflags 1.3.2",
"crossterm_winapi",
"libc",
"mio",
"parking_lot",
"signal-hook",
"signal-hook-mio",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "crossterm" name = "crossterm"
version = "0.27.0" version = "0.27.0"
@ -279,6 +301,12 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "dyn-clone"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]] [[package]]
name = "ego-tree" name = "ego-tree"
version = "0.6.2" version = "0.6.2"
@ -303,6 +331,24 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "fuzzy-matcher"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
dependencies = [
"thread_local",
]
[[package]]
name = "fxhash"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
dependencies = [
"byteorder",
]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.14" version = "0.2.14"
@ -384,6 +430,23 @@ version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
[[package]]
name = "inquire"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fddf93031af70e75410a2511ec04d49e758ed2f26dad3404a934e0fb45cc12a"
dependencies = [
"bitflags 2.5.0",
"crossterm 0.25.0",
"dyn-clone",
"fuzzy-matcher",
"fxhash",
"newline-converter",
"once_cell",
"unicode-segmentation",
"unicode-width",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.12.1" version = "0.12.1"
@ -400,7 +463,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]] [[package]]
name = "jrnl" name = "j"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"chrono", "chrono",
@ -408,6 +471,7 @@ dependencies = [
"dirs", "dirs",
"ego-tree", "ego-tree",
"indexmap", "indexmap",
"inquire",
"markdown", "markdown",
"owo-colors", "owo-colors",
"petgraph", "petgraph",
@ -511,6 +575,15 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "newline-converter"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47b6b097ecb1cbfed438542d16e84fd7ad9b0c76c8a65b7f9039212a3d14dc7f"
dependencies = [
"unicode-segmentation",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.18" version = "0.2.18"
@ -616,7 +689,7 @@ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"cassowary", "cassowary",
"compact_str", "compact_str",
"crossterm", "crossterm 0.27.0",
"indoc", "indoc",
"itertools", "itertools",
"lru", "lru",
@ -851,6 +924,16 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "thread_local"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
dependencies = [
"cfg-if",
"once_cell",
]
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.12" version = "1.0.12"

View file

@ -5,13 +5,23 @@
config, config,
pkgs, pkgs,
lib, lib,
lix-module,
rs-programs, rs-programs,
... ...
}: }:
with lib; with lib;
with builtins; { with builtins; {
imports = [lix-module.nixosModules.default];
nix = { nix = {
package = pkgs.nixVersions.stable; package = pkgs.nixVersions.stable;
settings = {
extra-substituters = [
"https://cache.lix.systems"
];
trusted-public-keys = [
"cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
];
};
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
keep-outputs = true keep-outputs = true

View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1713459701, "lastModified": 1714864355,
"narHash": "sha256-LjQ11ASxnv/FXfb8QnrIyMkyqSqcBPX+lFK8gu0jSQE=", "narHash": "sha256-uXNW6bapWFfkYIkK1EagydSrFMqycOYEDSq75GmUpjk=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "45ea0059fb325132fdc3c39faffb0941d25d08d3", "rev": "442a7a6152f49b907e73206dc8e1f46a61e8e873",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -28,11 +28,11 @@
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
"lastModified": 1713594079, "lastModified": 1714976745,
"narHash": "sha256-lYWehi0cqBdsL1W4xeUnUcXw4U4aBKKCmmQrR01yqE0=", "narHash": "sha256-SAYU6uaVcUmckp/RFxkndz7u7eX1D69piTIMmAAop6Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "3247290e1bba55878a2c62d43894d0309d29c918", "rev": "a291b6ad30f4ec949e6c98dde43d73d2946515c3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -41,6 +41,39 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flakey-profile": {
"locked": {
"lastModified": 1712898590,
"narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=",
"owner": "lf-",
"repo": "flakey-profile",
"rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d",
"type": "github"
},
"original": {
"owner": "lf-",
"repo": "flakey-profile",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -48,11 +81,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1713566308, "lastModified": 1714981474,
"narHash": "sha256-7Y91t8pheIzjJveUMAPyeh5NOq5F49Nq4Hl2532QpJs=", "narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "057117a401a34259c9615ce62218aea7afdee4d3", "rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -61,6 +94,48 @@
"type": "github" "type": "github"
} }
}, },
"lix": {
"flake": false,
"locked": {
"lastModified": 1714955862,
"narHash": "sha256-REWlo2RYHfJkxnmZTEJu3Cd/2VM+wjjpPy7Xi4BdDTQ=",
"ref": "refs/tags/2.90-beta.1",
"rev": "b6799ab0374a8e1907a48915d3187e07da41d88c",
"revCount": 15501,
"type": "git",
"url": "https://git@git.lix.systems/lix-project/lix"
},
"original": {
"ref": "refs/tags/2.90-beta.1",
"type": "git",
"url": "https://git@git.lix.systems/lix-project/lix"
}
},
"lix-module": {
"inputs": {
"flake-utils": "flake-utils",
"flakey-profile": "flakey-profile",
"lix": [
"lix"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1714868057,
"narHash": "sha256-Q9vGkxmuarySjPKO6yixjZ0tkaVIQS2wU9FpCpDA7+I=",
"ref": "refs/heads/main",
"rev": "e31baf57680bab449ab5b40179cc4a08a99f5314",
"revCount": 62,
"type": "git",
"url": "https://git.lix.systems/lix-project/nixos-module"
},
"original": {
"type": "git",
"url": "https://git.lix.systems/lix-project/nixos-module"
}
},
"mac-brcm-fw": { "mac-brcm-fw": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -92,11 +167,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1713537308, "lastModified": 1714906307,
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", "narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", "rev": "25865a40d14b3f9cf19f19b924e2ab4069b09588",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -107,11 +182,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1713344939, "lastModified": 1714782413,
"narHash": "sha256-jpHkAt0sG2/J7ueKnG7VvLLkBYUMQbXQ2L8OBpVG53s=", "narHash": "sha256-tbg0MEuKaPcUrnmGCu4xiY5F+7LW2+ECPKVAJd2HLwM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e402c3eb6d88384ca6c52ef1c53e61bdc9b84ddd", "rev": "651b4702e27a388f0f18e1b970534162dec09aff",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -122,11 +197,11 @@
}, },
"nixpkgs-unstable-small": { "nixpkgs-unstable-small": {
"locked": { "locked": {
"lastModified": 1713597487, "lastModified": 1715010189,
"narHash": "sha256-bD+FqUZidTjHblGjK+2LpIaHBmo1THF1HW3o4ZBqmrw=", "narHash": "sha256-VG/ax2TLmsF0G8M3Q/lE0P7U/pzky8NScim8ZGmIfAY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c0f9060ec3937d5a7cf3ce6c698e14d989b453e5", "rev": "95269ee8dbc9daacad586e8ad87567369a7e1042",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -140,6 +215,8 @@
"crane": "crane", "crane": "crane",
"fenix": "fenix", "fenix": "fenix",
"home-manager": "home-manager", "home-manager": "home-manager",
"lix": "lix",
"lix-module": "lix-module",
"mac-brcm-fw": "mac-brcm-fw", "mac-brcm-fw": "mac-brcm-fw",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
@ -150,11 +227,11 @@
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1713559870, "lastModified": 1714936835,
"narHash": "sha256-HsVa+QM2vMra80OjnjH7JhdvLeJuMdR4sxBNHJveMe4=", "narHash": "sha256-M+PpgfRMBfHo8Jb2ou/s3maAZbps0XnuHXQU9Hv9vL0=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "c83d8cf5844fff3d6e243ab408669222059af1c6", "rev": "c4618fe14d39992fbbb85c2d6cad028a232c13d2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -163,6 +240,21 @@
"repo": "rust-analyzer", "repo": "rust-analyzer",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -5,6 +5,15 @@
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-23.11"; nixpkgs-stable.url = "nixpkgs/nixos-23.11";
nixpkgs-unstable-small.url = "nixpkgs/nixos-unstable-small"; nixpkgs-unstable-small.url = "nixpkgs/nixos-unstable-small";
lix = {
url = "git+https://git@git.lix.systems/lix-project/lix?ref=refs/tags/2.90-beta.1";
flake = false;
};
lix-module = {
url = "git+https://git.lix.systems/lix-project/nixos-module";
inputs.lix.follows = "lix";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -17,7 +26,6 @@
crane = { crane = {
url = "github:ipetkov/crane"; url = "github:ipetkov/crane";
inputs = { inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
}; };
}; };
@ -32,6 +40,7 @@
nixpkgs, nixpkgs,
nixpkgs-stable, nixpkgs-stable,
nixpkgs-unstable-small, nixpkgs-unstable-small,
lix-module,
home-manager, home-manager,
nixos-hardware, nixos-hardware,
mac-brcm-fw, mac-brcm-fw,
@ -61,6 +70,8 @@
# cargoLock.lockFile = ./programs/jrnl/Cargo.lock; # cargoLock.lockFile = ./programs/jrnl/Cargo.lock;
# }; # };
s10e-jrnl = crane-lib.buildPackage { s10e-jrnl = crane-lib.buildPackage {
pname = "s10e-bs";
version = "0.0.1";
src = crane-lib.cleanCargoSource (crane-lib.path ./.); src = crane-lib.cleanCargoSource (crane-lib.path ./.);
}; };
}; };
@ -82,7 +93,7 @@
nixosConfigurations = { nixosConfigurations = {
monosodium-glutamate-g = nixpkgs.lib.nixosSystem { monosodium-glutamate-g = nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs pkgs-unstable-small pkgs-stable rs-programs; inherit inputs pkgs-unstable-small pkgs-stable rs-programs lix-module;
}; };
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
@ -107,7 +118,7 @@
}; };
catbook-j = nixpkgs.lib.nixosSystem { catbook-j = nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs pkgs-unstable-small pkgs-stable rs-programs; inherit inputs pkgs-unstable-small pkgs-stable rs-programs lix-module;
}; };
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
@ -132,7 +143,7 @@
}; };
potatobook-g = nixpkgs.lib.nixosSystem { potatobook-g = nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs pkgs-unstable-small rs-programs; inherit inputs pkgs-unstable-small rs-programs lix-module;
}; };
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [

View file

@ -78,7 +78,7 @@
}; };
boot.kernelPackages = pkgs.linuxPackages_zen; boot.kernelPackages = pkgs.linuxPackages_zen;
services.xserver.displayManager.autoLogin = { services.displayManager.autoLogin = {
enable = true; enable = true;
user = "jade"; user = "jade";
}; };

View file

@ -23,5 +23,5 @@
sensitivity = 256; sensitivity = 256;
}; };
services.xserver.libinput.touchpad.tapping = false; services.libinput.touchpad.tapping = false;
} }

View file

@ -65,9 +65,10 @@
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
services.xserver.libinput.touchpad.disableWhileTyping = true; services.libinput.touchpad = {
services.xserver.libinput.touchpad.tapping = false; disableWhileTyping = true;
tapping = false;
};
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.hostName = "potatobook-g"; networking.hostName = "potatobook-g";

View file

@ -1,4 +1,8 @@
{pkgs, ...}: { {
pkgs,
pkgs-stable,
...
}: {
home-manager.users.jade = {pkgs, ...}: { home-manager.users.jade = {pkgs, ...}: {
home.packages = with pkgs; [ home.packages = with pkgs; [
audacity audacity
@ -18,6 +22,7 @@
openscad-unstable openscad-unstable
openscad-lsp openscad-lsp
pkgs-stable.font-manager
fontforge-gtk fontforge-gtk
onlyoffice-bin_latest onlyoffice-bin_latest

View file

@ -67,7 +67,7 @@ in
services.illum.enable = true; services.illum.enable = true;
services.avahi = { services.avahi = {
enable = true; enable = true;
nssmdns = true; nssmdns4 = true;
openFirewall = true; openFirewall = true;
}; };
services.smartd = { services.smartd = {
@ -124,7 +124,6 @@ in
jellyfin-media-player jellyfin-media-player
# from environment.systemPackages cleanup # from environment.systemPackages cleanup
font-manager
xdotool xdotool
xorg.xwininfo xorg.xwininfo
gparted gparted

View file

@ -37,7 +37,7 @@
}; };
qt = { qt = {
enable = true; enable = true;
platformTheme = "gtk"; platformTheme.name = "gtk";
}; };
}; };
}; };

View file

@ -7,7 +7,6 @@
}; };
displayManager = { displayManager = {
defaultSession = "none+xmonad";
gdm.enable = true; gdm.enable = true;
}; };
@ -15,4 +14,6 @@
enable = true; enable = true;
}; };
}; };
services.displayManager.defaultSession = "none+xmonad";
} }

View file

@ -2,14 +2,15 @@
imports = [ imports = [
./evremap.nix ./evremap.nix
]; ];
services.xserver = { services = {
xkb = {
layout = "us";
variant = "altgr-intl";
};
libinput = { libinput = {
enable = true; enable = true;
}; };
xserver = {
xkb = {
layout = "us";
variant = "altgr-intl";
};
};
}; };
} }

View file

@ -48,7 +48,7 @@
"file-encoding" "file-encoding"
"file-type" "file-type"
]; ];
idle-timeout = 30; idle-timeout = 200;
indent-guides = { indent-guides = {
render = true; render = true;
character = ""; character = "";

View file

@ -1,5 +1,5 @@
[package] [package]
name = "jrnl" name = "j"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
@ -15,3 +15,4 @@ petgraph = "0.6.4"
ratatui = "0.26.2" ratatui = "0.26.2"
temp-file = "0.1.8" temp-file = "0.1.8"
termsize = "0.1.6" termsize = "0.1.6"
inquire = "0.7.5"

View file

@ -6,6 +6,7 @@ use std::{
process::Command, process::Command,
}; };
use inquire::Text;
use temp_file::{TempFile, TempFileBuilder}; use temp_file::{TempFile, TempFileBuilder};
use crate::md::{Entry, ToMd}; use crate::md::{Entry, ToMd};
@ -17,7 +18,7 @@ pub fn add_entry(path: PathBuf, title: Option<String>) -> io::Result<()> {
std::process::exit(1); std::process::exit(1);
} }
let title = prompt("Title")?; let title = Text::new("Title").prompt().unwrap();
let tmp = TempFileBuilder::new() let tmp = TempFileBuilder::new()
.suffix(".jrnl-entry.md") .suffix(".jrnl-entry.md")
@ -57,12 +58,3 @@ pub fn add_entry(path: PathBuf, title: Option<String>) -> io::Result<()> {
Ok(()) Ok(())
} }
fn prompt(title: &str) -> io::Result<String> {
print!("{}: ", title);
let _ = io::stdout().flush();
let mut buf = String::new();
let stdin = io::stdin();
stdin.read_line(&mut buf)?;
Ok(buf)
}

View file

@ -1,5 +1,4 @@
use chrono::{DateTime, FixedOffset}; use chrono::{DateTime, FixedOffset};
use markdown::{Block, Span};
use std::convert::identity; use std::convert::identity;
pub trait ToMd { pub trait ToMd {