summaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorNick Gerace <nickagerace@gmail.com>2020-09-02 00:44:11 -0400
committerNick Gerace <39320683+nickgerace@users.noreply.github.com>2020-09-02 00:49:36 -0400
commit50dc59bf472180abd91037ce40cb6b24dd4aa179 (patch)
treecd60be17b108a6628cf151b236ea2927e0c00336 /src/util.rs
parent2e4f067efe49dcdca7860256280904e5819382c1 (diff)
downloadgfold-50dc59bf472180abd91037ce40cb6b24dd4aa179.zip
Add recursive search feature, and skip sort feature
Add recursive search feature, and add skip sort feature (reliant on the former). Add unit tests for both features. Add AUR PKGBUILD GitHub repository to the README. Add Results and TableWrapper structs, along will all relevant methods and fucntions. Add Make targets for installing locally, and testing the recursive feature. Switch to object-driven harness, rather than a large parent function. Move "walk_dir" logic to a Results method. Use "expect" instead of unnecessary match blocks. Remove leftover FIXME comments for recursive search ideas. There is a lot of potential for optimization here, but this is the first pass.
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs
new file mode 100644
index 0000000..0e097e6
--- /dev/null
+++ b/src/util.rs
@@ -0,0 +1,17 @@
+/*
+ * gfold
+ * https://github.com/nickgerace/gfold
+ * Author: Nick Gerace
+ * License: Apache 2.0
+ */
+
+use git2::Repository;
+
+use std::path::Path;
+
+pub fn is_git_repo(target: &Path) -> bool {
+ match Repository::open(target) {
+ Ok(_) => true,
+ Err(_) => false,
+ }
+}