From 3f00499fd8004456d61dc715c319a1ab1c9044b4 Mon Sep 17 00:00:00 2001
From: ilor <kailoran@gmail.com>
Date: Sun, 10 Apr 2011 14:09:54 +0200
Subject: [PATCH] list available tagsets in tagset-tool

---
 libcorpus2/tagsetmanager.cpp | 6 ++++++
 libcorpus2/tagsetmanager.h   | 2 ++
 tagset-tool/main.cpp         | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/libcorpus2/tagsetmanager.cpp b/libcorpus2/tagsetmanager.cpp
index 4f7afef..610234f 100644
--- a/libcorpus2/tagsetmanager.cpp
+++ b/libcorpus2/tagsetmanager.cpp
@@ -21,6 +21,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
 #include <fstream>
 #include <iostream>
 #include <sstream>
+#include <boost/algorithm/string/join.hpp>
 
 namespace Corpus2 {
 
@@ -96,4 +97,9 @@ boost::shared_ptr<Tagset> TagsetManager::get_cache_entry(tagset_idx_t id)
 	}
 }
 
+std::string available_tagsets()
+{
+	return boost::algorithm::join(Path::Instance().list_files(".tagset"), " ");
+}
+
 } /* end ns Corpus2 */
diff --git a/libcorpus2/tagsetmanager.h b/libcorpus2/tagsetmanager.h
index 356541f..a5dc064 100644
--- a/libcorpus2/tagsetmanager.h
+++ b/libcorpus2/tagsetmanager.h
@@ -81,6 +81,8 @@ inline const Tagset& get_named_tagset(tagset_idx_t id) {
 	return TagsetManagerSingleton::Instance().get_tagset(id);
 }
 
+std::string available_tagsets();
+
 } /* end ns Corpus2 */
 
 #endif // LIBCORPUS2_TAGSETMANAGER_H
diff --git a/tagset-tool/main.cpp b/tagset-tool/main.cpp
index f3fa15f..9286269 100644
--- a/tagset-tool/main.cpp
+++ b/tagset-tool/main.cpp
@@ -240,6 +240,8 @@ int main(int argc, char** argv)
 
 	if (vm.count("help")) {
 		std::cout << desc << "\n";
+		std::cout << "Available tagsets: ";
+		std::cout << Corpus2::available_tagsets() << "\n";
 		return 1;
 	}
 
-- 
GitLab