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
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:

View File

@@ -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:

View File

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