# Path: mod/log.py
# RED = '\033[1;31m'
# GREEN = '\033[1;32m'
# YELLOW = '\033[1;33m'
# BLUE = '\033[1;36m'
# DEF = '\033[0;0m'
# def error(msg, fatal=True) :
# def warn(msg) :
# def ok(item, status) :
# def failed(item, status) :
# def optional(item, status) :
# def info(msg) :
# def colored(color, msg) :
# 
# Path: mod/util.py
# def fix_path(path) :
# def get_workspace_dir(fips_dir) :
# def get_project_dir(fips_dir, proj_name) :
# def get_build_root_dir(fips_dir, proj_name):
# def get_deploy_root_dir(fips_dir, proj_name):
# def get_build_dir(fips_dir, proj_name, cfg) :
# def get_deploy_dir(fips_dir, proj_name, cfg) :
# def get_fips_dir(proj_dir, name):
# def get_configs_dir(proj_dir):
# def get_verbs_dir(proj_dir):
# def get_generators_dir(proj_dir):
# def get_toolchains_dir(proj_dir):
# def get_giturl_from_url(url) :
# def get_gitbranch_from_url(url) :
# def get_project_name_from_url(url) :
# def get_project_name_from_dir(proj_dir) :
# def load_fips_yml(proj_dir) :
# def lookup_target_cwd(proj_dir, target) :
# def is_valid_project_dir(proj_dir) :
# def ensure_valid_project_dir(proj_dir) :
# def is_git_url(url) :
# def confirm(question) :
# def url_download_hook(count, block_size, total_size) :
# def get_host_platform() :
# def get_cfg_target_list(fips_dir, proj_dir, cfg):
# def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg):
# def get_cfg_defines_by_target(fips_dir, proj_dir, cfg):
# def get_num_cpucores():
# 
# Path: mod/settings.py
# def load(proj_dir) :
# def save(proj_dir, settings) :
# def get_default(key) :
# def get(proj_dir, key) :
# def set(proj_dir, key, value) :
# def unset(proj_dir, key) :
# def get_all_settings(proj_dir):
# 
# Path: mod/config.py
# def valid_build_tool(name) :
# def get_default_config() :
# def get_toolchain(fips_dir, proj_dir, cfg) :
# def exists(pattern, proj_dirs) : 
# def get_config_dirs(fips_dir, proj_dir) :
# def list(fips_dir, proj_dir, pattern) :
# def load(fips_dir, proj_dir, pattern) :
# def missing_build_tools(fips_dir, tool_name) :
# def check_sdk(fips_dir, platform_name) :
# def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) :
# 
# Path: mod/project.py
# def init(fips_dir, proj_name) :
# def clone(fips_dir, url) :
# def gen_project(fips_dir, proj_dir, cfg, force) :
# def gen(fips_dir, proj_dir, cfg_name) :
# def configure(fips_dir, proj_dir, cfg_name) :
# def make_clean(fips_dir, proj_dir, cfg_name) :
# def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) :
# def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) :
# def clean(fips_dir, proj_dir, cfg_name) :
# def get_target_list(fips_dir, proj_dir, cfg_name) :
# 
# Path: mod/tools/vscode.py
# def try_exists(exe_name):
# def exe_name():
# def check_exists(fips_dir) :
# def match(build_tool):
# def run(proj_dir):
# def read_cmake_targets(fips_dir, proj_dir, cfg, types):
# def read_cmake_headerdirs(fips_dir, proj_dir, cfg):
# def read_cmake_defines(fips_dir, proj_dir, cfg):
# def problem_matcher():
# def get_cc_header_paths():
# def get_vs_header_paths(fips_dir, proj_dir, cfg):
# def list_extensions() :
# def write_tasks_json(fips_dir, proj_dir, vscode_dir, cfg):
# def write_launch_json(fips_dir, proj_dir, vscode_dir, cfg, proj_settings):
# def write_c_cpp_properties_json(fips_dir, proj_dir, impex, cfg):
# def write_cmake_tools_settings(fips_dir, proj_dir, vscode_dir, cfg):
# def write_code_workspace_file(fips_dir, proj_dir, impex, cfg):
# def remove_vscode_tasks_launch_files(fips_dir, proj_dir, impex, cfg):
# def write_workspace_settings(fips_dir, proj_dir, cfg, proj_settings):
# def cleanup(fips_dir, proj_dir):
# 
# Path: mod/tools/clion.py
# def check_exists(fips_dir) :
# def match(build_tool):
# def run(proj_dir):
# def write_clion_module_files(fips_dir, proj_dir, cfg):
# def write_clion_workspace_file(fips_dir, proj_dir, cfg):
# def write_workspace_settings(fips_dir, proj_dir, cfg):
# def cleanup(fips_dir, proj_dir):


import os
import glob
import subprocess
from mod import log, util, settings, config, project
from mod.tools import vscode, clion
"""implement the 'open' verb

open
open [config]
"""



#-------------------------------------------------------------------------------
def run(fips_dir, proj_dir, args) :
    """run the 'open' verb (opens project in IDE)"""

# Path: mod/log.py
# RED = '\033[1;31m'
# GREEN = '\033[1;32m'
# YELLOW = '\033[1;33m'
# BLUE = '\033[1;36m'
# DEF = '\033[0;0m'
# def error(msg, fatal=True) :
# def warn(msg) :
# def ok(item, status) :
# def failed(item, status) :
# def optional(item, status) :
# def info(msg) :
# def colored(color, msg) :
# 
# Path: mod/util.py
# def fix_path(path) :
# def get_workspace_dir(fips_dir) :
# def get_project_dir(fips_dir, proj_name) :
# def get_build_root_dir(fips_dir, proj_name):
# def get_deploy_root_dir(fips_dir, proj_name):
# def get_build_dir(fips_dir, proj_name, cfg) :
# def get_deploy_dir(fips_dir, proj_name, cfg) :
# def get_fips_dir(proj_dir, name):
# def get_configs_dir(proj_dir):
# def get_verbs_dir(proj_dir):
# def get_generators_dir(proj_dir):
# def get_toolchains_dir(proj_dir):
# def get_giturl_from_url(url) :
# def get_gitbranch_from_url(url) :
# def get_project_name_from_url(url) :
# def get_project_name_from_dir(proj_dir) :
# def load_fips_yml(proj_dir) :
# def lookup_target_cwd(proj_dir, target) :
# def is_valid_project_dir(proj_dir) :
# def ensure_valid_project_dir(proj_dir) :
# def is_git_url(url) :
# def confirm(question) :
# def url_download_hook(count, block_size, total_size) :
# def get_host_platform() :
# def get_cfg_target_list(fips_dir, proj_dir, cfg):
# def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg):
# def get_cfg_defines_by_target(fips_dir, proj_dir, cfg):
# def get_num_cpucores():
# 
# Path: mod/settings.py
# def load(proj_dir) :
# def save(proj_dir, settings) :
# def get_default(key) :
# def get(proj_dir, key) :
# def set(proj_dir, key, value) :
# def unset(proj_dir, key) :
# def get_all_settings(proj_dir):
# 
# Path: mod/config.py
# def valid_build_tool(name) :
# def get_default_config() :
# def get_toolchain(fips_dir, proj_dir, cfg) :
# def exists(pattern, proj_dirs) : 
# def get_config_dirs(fips_dir, proj_dir) :
# def list(fips_dir, proj_dir, pattern) :
# def load(fips_dir, proj_dir, pattern) :
# def missing_build_tools(fips_dir, tool_name) :
# def check_sdk(fips_dir, platform_name) :
# def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) :
# 
# Path: mod/project.py
# def init(fips_dir, proj_name) :
# def clone(fips_dir, url) :
# def gen_project(fips_dir, proj_dir, cfg, force) :
# def gen(fips_dir, proj_dir, cfg_name) :
# def configure(fips_dir, proj_dir, cfg_name) :
# def make_clean(fips_dir, proj_dir, cfg_name) :
# def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) :
# def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) :
# def clean(fips_dir, proj_dir, cfg_name) :
# def get_target_list(fips_dir, proj_dir, cfg_name) :
# 
# Path: mod/tools/vscode.py
# def try_exists(exe_name):
# def exe_name():
# def check_exists(fips_dir) :
# def match(build_tool):
# def run(proj_dir):
# def read_cmake_targets(fips_dir, proj_dir, cfg, types):
# def read_cmake_headerdirs(fips_dir, proj_dir, cfg):
# def read_cmake_defines(fips_dir, proj_dir, cfg):
# def problem_matcher():
# def get_cc_header_paths():
# def get_vs_header_paths(fips_dir, proj_dir, cfg):
# def list_extensions() :
# def write_tasks_json(fips_dir, proj_dir, vscode_dir, cfg):
# def write_launch_json(fips_dir, proj_dir, vscode_dir, cfg, proj_settings):
# def write_c_cpp_properties_json(fips_dir, proj_dir, impex, cfg):
# def write_cmake_tools_settings(fips_dir, proj_dir, vscode_dir, cfg):
# def write_code_workspace_file(fips_dir, proj_dir, impex, cfg):
# def remove_vscode_tasks_launch_files(fips_dir, proj_dir, impex, cfg):
# def write_workspace_settings(fips_dir, proj_dir, cfg, proj_settings):
# def cleanup(fips_dir, proj_dir):
# 
# Path: mod/tools/clion.py
# def check_exists(fips_dir) :
# def match(build_tool):
# def run(proj_dir):
# def write_clion_module_files(fips_dir, proj_dir, cfg):
# def write_clion_workspace_file(fips_dir, proj_dir, cfg):
# def write_workspace_settings(fips_dir, proj_dir, cfg):
# def cleanup(fips_dir, proj_dir):


# Path: verbs/open.py
import os
import glob
import subprocess
from mod import log, util, settings, config, project
from mod.tools import vscode, clion

"""implement the 'open' verb

open
open [config]
"""



#-------------------------------------------------------------------------------
def run(fips_dir, proj_dir, args) :
    """run the 'open' verb (opens project in IDE)"""

    if not util.is_valid_project_dir(proj_dir) :