cli options

This commit is contained in:
Arseniy Kuznetsov
2021-01-04 20:47:21 +01:00
parent c930435191
commit 18deb23c38
3 changed files with 3 additions and 52 deletions

View File

@@ -112,7 +112,8 @@ class LinuxConfig(OSConfig):
''' '''
@property @property
def mktxp_user_dir_path(self): 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: class MKTXPConfigHandler:

View File

@@ -14,7 +14,6 @@
import os, sys, shlex, tempfile, shutil, re import os, sys, shlex, tempfile, shutil, re
from datetime import timedelta from datetime import timedelta
import subprocess, hashlib import subprocess, hashlib
import keyring, getpass
from collections import Iterable from collections import Iterable
from contextlib import contextmanager from contextlib import contextmanager
@@ -178,55 +177,6 @@ class UniqueDirNamesChecker:
break 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): class UniquePartialMatchList(list):
''' Enables matching elements by unique "shortcuts" ''' Enables matching elements by unique "shortcuts"
e.g: e.g:

View File

@@ -20,7 +20,7 @@ with open(path.join(pkg_dir, 'README.md'), encoding='utf-8') as f:
setup( setup(
name='mktxp', name='mktxp',
version='0.16', version='0.17',
url='https://github.com/akpw/mktxp', url='https://github.com/akpw/mktxp',