moic.cli package

Submodules

moic.cli.base module

Module for Moic configuration

Configuration file is stored under CONF_DIR and contains the following architecture

default:
contexts:
  • name: my_context type: <plugin> login: my_login

current_context: my_context

class moic.cli.base.CustomSettings[source]

Bases: object

Class representing the current settings. It’s a subtree of global_settings containing only the configuration contained into the current context

drill_down(conf: dict, keys: list) → str[source]

Drill down into the configuration tree when the search key is composite For example : key.subkey.subsubkey

Parameters:
  • conf (dict) – The configuration to drill down
  • keys (list) – The keys list which should be used to browse the conf
Returns:

The value of the key in the conf

Return type:

str

get(value, default=None) → str[source]

Get a value into the Box element returned by global_settings (dynaconf.LazySetting)

Parameters:value (str) – The key value to return
Returns:The value within the configuration
Return type:str
reload()[source]

Force reloading configurat from {CONF_DIR}/config.yaml

class moic.cli.base.MoicInstance[source]

Bases: object

MoicInstance Class represents the main class of the tool which should be herited by other Issuer Instance, such as MoicJiraInstance

add_context(force: bool = False) → None[source]

Add a new context in the configuration

Parameters:force (bool) – If True it doesn’t check the current configuration before
create_session_instance() → None[source]

Setup the session instance

custom_config_label = 'Would you like to run custom configuration'
delete_context(context_name: str) → None[source]

Delete the given context from the contexts list. If it’s the current_context, set the current context to ‘’

Parameters:context_name (str) – The context name which should be deleted
instance = None
session

Property which retrieve the session to interact with the issuer

set_current_context(context_name: str) → None[source]

Set the current configuration context to use when executing commands

Parameters:context_name (str) – The context name which should be present in the contexts list
setup_home_dir() → None[source]

Setup configuration directory. It creates the root configuration directory an empty .yaml conf file and the templates directory

Returns:None
update_config(sub_conf: dict) → None[source]

Update the local configuration merging in it a new dict of configuration

Parameters:sub_conf (dict) – The new configuration to merge into the config.yaml file
Returns:None
moic.cli.base.merge_config(a: dict, b: dict, path: str = None) → dict[source]

Merge two config dict together

Parameters:
  • a (dict) – The main config dict
  • b (dict) – The secondary config dict which should be merged into a
  • path (str) – The path where to merde
Returns:

The merged dict

Return type:

dict

moic.cli.base.merge_contexts(current_contexts: list, new_contexts: list) → list[source]

Merge two context list based on the context.name key It will update exiting contexts with new values and append non existing contexts

Parameters:
  • current_contexts (list) – The context list present in the configuration
  • new_contexts (list) – The new context list to merge into the configuration
Returns:

The aggregated context list

Return type:

list

Module contents

Moic Cli Package