git.fiddlerwoaroof.com
dual_control_tool.cc
7d075ab4
 /* Copyright (C) CJ Affiliate
  *
  * You may use, distribute and modify this code under  the
  * terms of the  GNU General Public License  version 2  or
  * later.
  *
  * You should have received a copy of the license with this
  * file. If not, you will find a copy in the "LICENSE" file
  * at https://github.com/cjdev/dual-control.
  */
 
e21fc4bc
 #include <string>
 #include <iostream>
 
66796de1
 #include "installer.h"
f2a91ef8
 #include "generator.h"
 #include "sys_stdlib.h"
 #include "user.h"
 #include "sys_unistd.h"
 #include "sys_pwd.h"
 #include "token.h"
d87655b0
 #include "system.h"
f2a91ef8
 #include "sys_fstream.h"
 
23c0bd4d
 namespace
 {
 class system init_system()
 {
     stdlib stdlib (stdlib::get());
     sys_time time (sys_time::get());
     class system system (stdlib, time);
     return system;
 }
 installer init_installer()
 {
     fstreams fstreams (fstreams::create());
     tokens tokens (tokens::create (fstreams));
     pwd pwd (pwd::create());
     unistd unistd (unistd::create());
     directory directory (directory::create (unistd, pwd));
     stdlib stdlib (stdlib::get());
     generator generator{make_generator (stdlib)};
     installer installer (installer::create (tokens, unistd,
                                             directory, generator));
f2a91ef8
 
23c0bd4d
     return installer;
 }
f2a91ef8
 }
e21fc4bc
 
7d075ab4
 int main (int argc, char *argv[])
 {
23c0bd4d
     class system system (init_system());
     installer tool (init_installer());
e21fc4bc
     std::string generated_token = tool.install_token();
     std::cout << generated_token << std::endl;
     return 0;
 }
7d075ab4