Commit
+12 -10 +/-1 browse
1 | diff --git a/bin/note.ml b/bin/note.ml |
2 | index cb27b59..e88536d 100644 |
3 | --- a/bin/note.ml |
4 | +++ b/bin/note.ml |
5 | @@ -80,8 +80,7 @@ is provided then all notes will be listed. |
6 | |> List.map ~f:(fun path -> options |> Note.Adapter.load ~path) |
7 | |> List.iter ~f:(fun notes -> |
8 | let note = notes |> Note.fst in |
9 | - note |> Note.to_string |> print_endline) |
10 | - ] |
11 | + note |> Note.to_string |> print_endline)] |
12 | |
13 | let create_note = |
14 | let open Command.Let_syntax in |
15 | @@ -108,16 +107,19 @@ on_modification callback will be invoked if the file is committed to disk. |
16 | in |
17 | options |> Note.Adapter.create ~description ~tags ~content ~path] |
18 | |
19 | - let delete_note = |
20 | + let remove_note = |
21 | let open Command.Let_syntax in |
22 | - Command.basic ~summary:"delete an existing note" |
23 | - ~readme:(fun () -> |
24 | - {| |
25 | - Delete the first note that matches the filter criteria. |
26 | - |}) |
27 | + Command.basic ~summary:"remove an existing note" |
28 | + ~readme:(fun () -> {||}) |
29 | [%map_open |
30 | let path = anon ("path" %: name_arg) in |
31 | - fun () -> options |> Note.Adapter.remove ~path] |
32 | + fun () -> |
33 | + let message = (Format.sprintf "Are you sure you want to delete note %s?" path) in |
34 | + match options |> Note.Adapter.find ~path with |
35 | + | Some _ -> |
36 | + let callback () = options |> Note.Adapter.remove ~path in |
37 | + Util.prompt ~callback message |
38 | + | None -> failwith "not found"] |
39 | |
40 | let edit_note = |
41 | let open Command.Let_syntax in |
42 | @@ -175,7 +177,7 @@ let run = |
43 | Command.group ~summary:"config management" |
44 | [ ("show", config_show); ("get", config_get); ("set", config_set) ] |
45 | ); |
46 | - ("delete", delete_note); |
47 | + ("rm", remove_note); |
48 | ("edit", edit_note); |
49 | ("ls", list_notes); |
50 | ("sync", sync); |