summaryrefslogtreecommitdiff
path: root/commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'commands.cpp')
-rw-r--r--commands.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/commands.cpp b/commands.cpp
index db693e5..3000f31 100644
--- a/commands.cpp
+++ b/commands.cpp
@@ -6,14 +6,14 @@
#include <iostream>
-std::vector<std::string> commands::Commands::ls() {
+std::vector<std::string> Commands::ls() {
if(args.size() != 2) {
- throw commands::CommandException("usage: ls DIR");
+ throw CommandException("usage: ls DIR");
}
MusicDirectory::p dir = music::get_directory(args[1]);
if(!dir) {
- throw commands::CommandException("no such directory");
+ throw CommandException("no such directory");
}
std::cout << dir->path << std::endl;
std::vector<std::string> result;
@@ -29,9 +29,9 @@ std::vector<std::string> commands::Commands::ls() {
return result;
}
-std::vector<std::string> commands::Commands::find() {
+std::vector<std::string> Commands::find() {
if(args.size() != 3) {
- throw commands::CommandException("usage: find TYPE SEARCH");
+ throw CommandException("usage: find TYPE SEARCH");
}
FindFunction ff;
@@ -43,12 +43,12 @@ std::vector<std::string> commands::Commands::find() {
types.push_back(it->first);
}
std::string s = boost::str(boost::format("unknown search type, must be one of %s") % boost::algorithm::join(types, ", "));
- throw commands::CommandException(s.c_str());
+ throw CommandException(s.c_str());
}
std::vector<MusicListing::p> ml = ff(args[2]);
if(!ml.size()) {
- throw commands::CommandException("no results");
+ throw CommandException("no results");
}
std::vector<std::string> result;
@@ -60,9 +60,9 @@ std::vector<std::string> commands::Commands::find() {
return result;
}
-std::vector<std::string> commands::Commands::update() {
+std::vector<std::string> Commands::update() {
if(args.size() != 2) {
- throw commands::CommandException("usage: update DIR");
+ throw CommandException("usage: update DIR");
}
io_service.post(boost::bind(music::begin_update, args[1]));
@@ -71,14 +71,14 @@ std::vector<std::string> commands::Commands::update() {
return v;
}
-commands::Commands::Commands(boost::asio::io_service& io_service_, std::vector<std::string>& args_) : io_service(io_service_), args(args_) {
- handlers["ls"] = &commands::Commands::ls;
- handlers["find"] = &commands::Commands::find;
+Commands::Commands(boost::asio::io_service& io_service_, std::vector<std::string>& args_) : io_service(io_service_), args(args_) {
+ handlers["ls"] = &Commands::ls;
+ handlers["find"] = &Commands::find;
find_handlers["artist"] = music::find_artist;
- handlers["update"] = &commands::Commands::update;
+ handlers["update"] = &Commands::update;
}
-std::vector<std::string> commands::Commands::operator()() {
+std::vector<std::string> Commands::operator()() {
assert(args.size());
Handler h = handlers[args[0]];
if(!h) {