Commit dbf25d8 1 parent 9bd6905 commit dbf25d8 Copy full SHA for dbf25d8
File tree 4 files changed +17
-0
lines changed
4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 6
6
* Rewrite core functionality by using cached state instead of relying on the file system.
7
7
WARNING! this version is completely different functionally from the older one and the tags have to be recreated
8
8
after updating it. [ #30 ] ( https://github.com/wojciechkepka/wutag/pull/30 )
9
+ * Add ` clean-cache ` subcommand that cleans the cached tag registry from the filesystem.
9
10
10
11
11
12
# 0.3.0
Original file line number Diff line number Diff line change @@ -101,6 +101,14 @@ impl App {
101
101
Command :: Cp ( ref opts) => self . cp ( opts) ,
102
102
Command :: Edit ( ref opts) => self . edit ( opts) ,
103
103
Command :: PrintCompletions ( ref opts) => self . print_completions ( opts) ,
104
+ Command :: CleanCache => self . clean_cache ( ) ,
105
+ }
106
+ }
107
+
108
+ fn clean_cache ( & mut self ) {
109
+ self . registry . clear ( ) ;
110
+ if let Err ( e) = self . registry . save ( ) {
111
+ println ! ( "{:?}" , e) ;
104
112
}
105
113
}
106
114
Original file line number Diff line number Diff line change @@ -155,4 +155,6 @@ pub enum Command {
155
155
Edit ( EditOpts ) ,
156
156
/// Prints completions for the specified shell to stdout.
157
157
PrintCompletions ( CompletionsOpts ) ,
158
+ /// Clean the cached tag registry.
159
+ CleanCache ,
158
160
}
Original file line number Diff line number Diff line change @@ -57,6 +57,12 @@ impl TagRegistry {
57
57
fs:: write ( & self . path , & serialized) . context ( "failed to save registry" )
58
58
}
59
59
60
+ /// Clears this tag registry by removing all entries and tags.
61
+ pub fn clear ( & mut self ) {
62
+ self . tags . clear ( ) ;
63
+ self . entries . clear ( ) ;
64
+ }
65
+
60
66
/// Updates the entry or adds it if it is not present.
61
67
pub fn add_or_update_entry ( & mut self , entry : EntryData ) -> EntryId {
62
68
let pos = self
You can’t perform that action at this time.
0 commit comments