File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1111
1212using namespace std ;
1313
14+ // https://stackoverflow.com/a/5867387
15+ std::string getEnvVar (std::string const & key)
16+ {
17+ char const * val = getenv (key.c_str ());
18+ return val == NULL ? std::string () : std::string (val);
19+ }
20+
1421int main (int argc, char ** args)
1522{
1623 init_networking ();
1724
1825 setUserAgent (" get-cli/" APP_VERSION);
1926
27+ // our config dir is in our current directory
28+ std::string config_dir = " ./.get/" ;
29+
30+ // or use the home dir if it's defined
31+ std::string homeDir = getEnvVar (" HOME" );
32+ if (homeDir != " " ) {
33+ config_dir = homeDir + " /.config/libget-cli/" ;
34+ }
35+
2036 // create main Get object
21- Get get (" ./.get/ " , " https://switch.cdn.fortheusers.org" );
37+ Get get (config_dir , " https://switch.cdn.fortheusers.org" );
2238
2339 auto repos = get.getRepos ();
2440 auto packages = get.getPackages ();
Original file line number Diff line number Diff line change 55#include < optional>
66#include < vector>
77#include < unordered_set>
8+ #include < unordered_map>
89
910void info (const char * format, ...);
1011
You can’t perform that action at this time.
0 commit comments