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