mirror of
				https://github.com/KevinMidboe/mktxp-no-cli.git
				synced 2025-10-29 17:50:23 +00:00 
			
		
		
		
	cli options
This commit is contained in:
		| @@ -112,7 +112,8 @@ class LinuxConfig(OSConfig): | ||||
|     ''' | ||||
|     @property | ||||
|     def mktxp_user_dir_path(self): | ||||
|         return FSHelper.full_path('/etc/mktxp') | ||||
|         return FSHelper.full_path('~/mktxp') | ||||
|         #return FSHelper.full_path('/etc/mktxp') | ||||
|  | ||||
|  | ||||
| class MKTXPConfigHandler: | ||||
|   | ||||
| @@ -14,7 +14,6 @@ | ||||
| import os, sys, shlex, tempfile, shutil, re | ||||
| from datetime import timedelta | ||||
| import subprocess, hashlib | ||||
| import keyring, getpass | ||||
| from collections import Iterable | ||||
| from contextlib import contextmanager | ||||
|  | ||||
| @@ -178,55 +177,6 @@ class UniqueDirNamesChecker: | ||||
|                     break | ||||
|  | ||||
|  | ||||
| class PasswordHandler: | ||||
|     ''' Password Helper | ||||
|     ''' | ||||
|     @staticmethod | ||||
|     def get_pwd_input(confirm = False): | ||||
|         ''' Gets password from command line | ||||
|         ''' | ||||
|         pwd = getpass.getpass('Enter password:') | ||||
|         if pwd and confirm: | ||||
|             pwd_confirm = getpass.getpass('Confirm password:') | ||||
|             if pwd != pwd_confirm: | ||||
|                 print ("Passwords do not match") | ||||
|                 return None | ||||
|         return pwd | ||||
|  | ||||
|     @classmethod | ||||
|     def get_pwd(cls, pwd_entry_name = None, confirm = False): | ||||
|         ''' Gets password from an OS-specific keyring or command line | ||||
|         ''' | ||||
|         pwd = None | ||||
|         new_pwd = False | ||||
|  | ||||
|         if pwd_entry_name: | ||||
|             pwd = keyring.get_password(pwd_entry_name, getpass.getuser()) | ||||
|  | ||||
|         if not pwd: | ||||
|             pwd = cls.get_pwd_input(confirm = confirm) | ||||
|             new_pwd = True | ||||
|  | ||||
|         return pwd, new_pwd | ||||
|  | ||||
|     @staticmethod | ||||
|     def store_pwd(pwd, pwd_entry_name): | ||||
|         ''' Store password into an OS-specific keyring | ||||
|         ''' | ||||
|         if not (pwd and pwd_entry_name): | ||||
|             return | ||||
|         keyring.set_password(pwd_entry_name, getpass.getuser(), pwd) | ||||
|  | ||||
|     @staticmethod | ||||
|     def delete_pwd(pwd_entry_name): | ||||
|         ''' Deletes password from an OS-specific keyring | ||||
|         ''' | ||||
|         if pwd_entry_name: | ||||
|             pwd = keyring.get_password(pwd_entry_name, getpass.getuser()) | ||||
|             if pwd: | ||||
|                 keyring.delete_password(pwd_entry_name, getpass.getuser()) | ||||
|  | ||||
|  | ||||
| class UniquePartialMatchList(list): | ||||
|     ''' Enables matching elements by unique "shortcuts" | ||||
|         e.g: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user