From e36f260c2ebc5e21724e5eedf0a91d2bc66cceec Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 4 Apr 2022 21:11:25 +0200 Subject: Treat instances with names starting with _ as abstract and do not list them --- README.md | 5 ++++- src/etoolkit/__init__.py | 2 +- src/etoolkit/__main__.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c6c69e0..a4efa6f 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ Another possibility is to pass the value to *etoolkit*'s *stdin* using a pipe. ... or if the *ETOOLKIT_MASTER_PASSWORD* env. variable is defined, its value will be used instead of prompting for password. -Listing all available instances defined in the configuration file and then +Listing available instances defined in the configuration file and then loading a specific instance can be achieved by: ```bash @@ -166,6 +166,9 @@ loading a specific instance can be achieved by: etoolkit ``` +Instances with names starting with *_* will be considered *abstract* and will +not be displayed by *--list*. + *etoolkit* will prompt for the master password the first time it encounters and encrypted value. Once provided the master password will be used to decrypt the rest of the encrypted values. diff --git a/src/etoolkit/__init__.py b/src/etoolkit/__init__.py index e2925ef..ae6465c 100644 --- a/src/etoolkit/__init__.py +++ b/src/etoolkit/__init__.py @@ -17,7 +17,7 @@ from .etoolkit import EtoolkitInstance, EtoolkitInstanceError __author__ = 'Simeon Simeonov' -__version__ = '1.1.0' +__version__ = '1.2.0-beta1' __license__ = 'GPL3' diff --git a/src/etoolkit/__main__.py b/src/etoolkit/__main__.py index 603bb2e..299d75c 100644 --- a/src/etoolkit/__main__.py +++ b/src/etoolkit/__main__.py @@ -306,7 +306,10 @@ def main(inargs=None): sys.exit(0) if args.list: for instance_name in sorted( - config_dict.get('instances', {}).keys() + filter( + lambda s: not s.startswith('_'), + config_dict.get('instances', {}).keys(), + ) ): print(instance_name) sys.exit(0) -- cgit v1.3