Use voussoirkit getpermission for yes/no prompts.
This commit is contained in:
parent
dc48da8a27
commit
af6176286c
5 changed files with 12 additions and 22 deletions
|
@ -17,6 +17,7 @@ import random
|
|||
import re
|
||||
import sys
|
||||
|
||||
from voussoirkit import getpermission
|
||||
from voussoirkit import safeprint
|
||||
from voussoirkit import spinal
|
||||
|
||||
|
@ -52,13 +53,8 @@ def brename(transformation, autoyes=False, recurse=False):
|
|||
|
||||
loop(pairs, dry=True)
|
||||
|
||||
ok = autoyes
|
||||
if not ok:
|
||||
print('Is this correct? y/n')
|
||||
ok = input('>').lower() in ('y', 'yes', 'yeehaw')
|
||||
|
||||
if autoyes or getpermission.getpermission('Is this correct?'):
|
||||
pairs = reversed(pairs)
|
||||
if ok:
|
||||
loop(pairs, dry=False)
|
||||
|
||||
def excise(s, mark_left, mark_right):
|
||||
|
|
|
@ -4,6 +4,7 @@ import pyperclip
|
|||
import re
|
||||
import sys
|
||||
|
||||
from voussoirkit import getpermission
|
||||
from voussoirkit import winglob
|
||||
|
||||
|
||||
|
@ -21,8 +22,7 @@ def contentreplace(filename, replace_from, replace_to, autoyes=False, do_regex=F
|
|||
if occurances == 0:
|
||||
return
|
||||
|
||||
permission = autoyes or (input('Replace? ').lower() in ('y', 'yes'))
|
||||
if not permission:
|
||||
if not (autoyes or getpermission.getpermission('Replace?')):
|
||||
return
|
||||
|
||||
if do_regex:
|
||||
|
|
|
@ -12,6 +12,7 @@ import string
|
|||
import re
|
||||
import sys
|
||||
|
||||
from voussoirkit import getpermission
|
||||
from voussoirkit import pathclass
|
||||
from voussoirkit import safeprint
|
||||
|
||||
|
@ -76,12 +77,7 @@ def fileprefix(
|
|||
message = f'{oldname} -> {newname}'
|
||||
safeprint.safeprint(message)
|
||||
|
||||
ok = autoyes
|
||||
if not ok:
|
||||
print('Is this correct? y/n')
|
||||
ok = input('>').lower() in ('y', 'yes', 'yeehaw')
|
||||
|
||||
if ok:
|
||||
if autoyes or getpermission.getpermission('Is this correct?'):
|
||||
for (oldname, newname) in rename_pairs:
|
||||
os.rename(oldname, newname)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import argparse
|
|||
import os
|
||||
import sys
|
||||
|
||||
from voussoirkit import getpermission
|
||||
from voussoirkit import spinal
|
||||
|
||||
def filepull(pull_from='.', autoyes=False):
|
||||
|
@ -30,12 +31,7 @@ def filepull(pull_from='.', autoyes=False):
|
|||
for f in files:
|
||||
print(f.basename)
|
||||
|
||||
ok = autoyes
|
||||
if not ok:
|
||||
print('Move %d files?' % len(files))
|
||||
ok = input('> ').lower() in ['y', 'yes']
|
||||
|
||||
if ok:
|
||||
if autoyes or getpermission.getpermission(f'Move {len(files)} files?'):
|
||||
for f in files:
|
||||
local = os.path.join('.', f.basename)
|
||||
os.rename(f.absolute_path, local)
|
||||
|
|
|
@ -6,6 +6,7 @@ import sys
|
|||
import textwrap
|
||||
import time
|
||||
|
||||
from voussoirkit import getpermission
|
||||
from voussoirkit import passwordy
|
||||
from voussoirkit import winwhich
|
||||
|
||||
|
@ -373,7 +374,8 @@ def pypi_release(do_tag=False, versionbump='patch'):
|
|||
|
||||
linebreak()
|
||||
|
||||
input(f'PRESS ENTER TO RELEASE {name} {new_version}.')
|
||||
if not getpermission.getpermission(f'READY TO RELEASE {name} {new_version}.'):
|
||||
return
|
||||
|
||||
write_setup(setup_py)
|
||||
|
||||
|
|
Loading…
Reference in a new issue