diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/command.cc | 9 | ||||
| -rw-r--r-- | common/command.h | 2 | 
2 files changed, 9 insertions, 2 deletions
| diff --git a/common/command.cc b/common/command.cc index 4822585c..209f8cab 100644 --- a/common/command.cc +++ b/common/command.cc @@ -358,7 +358,14 @@ int CommandHandler::exec()          if (executeBeforeContext())              return 0; -        std::unique_ptr<Context> ctx = createContext(); +        std::unordered_map<std::string,Property> values; +        if (vm.count("json")) { +            std::string filename = vm["json"].as<std::string>(); +            std::ifstream f(filename); +            if (!load_json_settings(f, filename, values)) +                log_error("Loading design failed.\n"); +        } +        std::unique_ptr<Context> ctx = createContext(values);          settings = std::unique_ptr<Settings>(new Settings(ctx.get()));          setupContext(ctx.get());          setupArchContext(ctx.get()); diff --git a/common/command.h b/common/command.h index d4f9a12e..5c5ceb9a 100644 --- a/common/command.h +++ b/common/command.h @@ -39,7 +39,7 @@ class CommandHandler    protected:      virtual void setupArchContext(Context *ctx) = 0; -    virtual std::unique_ptr<Context> createContext() = 0; +    virtual std::unique_ptr<Context> createContext(std::unordered_map<std::string,Property> &values) = 0;      virtual po::options_description getArchOptions() = 0;      virtual void validate(){};      virtual void customAfterLoad(Context *ctx){}; | 
