cellar/src/cellar.cpp

40 lines
959 B
C++
Raw Normal View History

2017-03-12 17:13:07 -07:00
#include <iostream>
#include <map>
2017-03-12 17:13:07 -07:00
#include <string>
2017-03-12 22:33:42 -07:00
#include <vector>
2017-03-12 17:13:07 -07:00
#include "json.hpp"
2017-03-12 17:13:07 -07:00
2017-03-13 19:03:07 -07:00
#include "bottles.hpp"
2017-03-12 17:13:07 -07:00
2017-03-12 22:33:42 -07:00
using namespace std;
using namespace cellar;
using json = nlohmann::json;
2017-03-12 17:13:07 -07:00
2017-03-12 22:33:42 -07:00
int main(int argc, char* argv[]) {
map<string, bottles::Bottle> bottles = bottles::get_bottles();
for (auto& item : bottles) {
cout << item.first << "- ";
bottles::Bottle current = item.second;
switch (current.type) {
case bottles::bottle_anonymous:
cout << "anonymous wine bottle";
break;
case bottles::bottle_labelled:
cout << current.config["name"];
break;
case bottles::bottle_symlink:
cout << "symlink to ";
cout << current.canonical_path;
break;
default:
cout << "broken or unsupported wine bottle";
}
cout << endl;
2017-03-12 22:33:42 -07:00
}
2017-03-13 19:03:07 -07:00
return 0;
2017-03-12 15:43:11 -07:00
}