diff --git a/nc_password_client/nc_password_client.py b/nc_password_client/nc_password_client.py index cc955a1..457a82a 100644 --- a/nc_password_client/nc_password_client.py +++ b/nc_password_client/nc_password_client.py @@ -50,6 +50,10 @@ class NcPasswordClient: '''List all passwords''' print(json.dumps(self.nc.list_passwords(), indent=2)) + def create_password(self, obj): + '''Create a password with an object''' + print(json.dumps(self.nc.create_password(obj), indent=2)) + def _init_log(self): ''' Initialize log object ''' self._log = logging.getLogger("nc_password_client") @@ -145,5 +149,13 @@ def list(ctx): '''Show all password''' ctx.obj['NcPasswordClient'].list_passwords() +@cli.command() +@click.option('--obj', '-o', required=True, help='JSON object for a password') +@click_config_file.configuration_option() +@click.pass_context +def create_password(ctx, obj): + '''Show all password''' + ctx.obj['NcPasswordClient'].create_password(json.loads(obj)) + if __name__ == "__main__": cli(obj={})