Skip to content

Commit 16199f1

Browse files
committed
v0.1.4: scrolling + personalized config file
1 parent ad7a1e1 commit 16199f1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ops.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ use crossterm::{
55
};
66
use std::fs;
77
use std::io;
8-
use std::path::PathBuf;
8+
use std::path::{Path, PathBuf};
99
use std::process::Command;
1010

1111
// open the user's preferred editor for the given file
1212
pub fn open_editor(
13-
base_path: &PathBuf,
13+
base_path: &Path,
1414
file_path: Option<&PathBuf>,
1515
editor_cmd: Option<&str>,
1616
) -> Result<(), KirokuError> {
@@ -31,7 +31,7 @@ pub fn open_editor(
3131
cmd.arg(path);
3232
}
3333

34-
let status = cmd.status().map_err(|e| KirokuError::Io(e))?;
34+
let status = cmd.status().map_err(KirokuError::Io)?;
3535

3636
// restore raw mode after editor exits
3737
execute!(io::stdout(), EnterAlternateScreen)?;
@@ -47,7 +47,7 @@ pub fn open_editor(
4747
}
4848

4949
// create a new markdown file with the given filename
50-
pub fn create_note(base_path: &PathBuf, filename: &str) -> Result<PathBuf, KirokuError> {
50+
pub fn create_note(base_path: &Path, filename: &str) -> Result<PathBuf, KirokuError> {
5151
let mut safe_filename = filename.trim().replace(" ", "_");
5252
if !safe_filename.ends_with(".md") {
5353
safe_filename.push_str(".md");
@@ -67,13 +67,13 @@ pub fn create_note(base_path: &PathBuf, filename: &str) -> Result<PathBuf, Kirok
6767
}
6868

6969
// permanently delete the specified note file
70-
pub fn delete_note(path: &PathBuf) -> Result<(), KirokuError> {
70+
pub fn delete_note(path: &Path) -> Result<(), KirokuError> {
7171
fs::remove_file(path)?;
7272
Ok(())
7373
}
7474

7575
// sync changes with the remote git repository
76-
pub fn run_git_sync(base_path: &PathBuf) -> Result<String, KirokuError> {
76+
pub fn run_git_sync(base_path: &Path) -> Result<String, KirokuError> {
7777
println!("Executing git sync in: {:?}", base_path);
7878
if !base_path.join(".git").exists() {
7979
return Err(KirokuError::Git(

0 commit comments

Comments
 (0)