Add more option for URI
This commit is contained in:
19
core/cli.py
19
core/cli.py
@ -185,8 +185,23 @@ def remove_user(username: str):
|
|||||||
|
|
||||||
@cli.command('show-user-uri')
|
@cli.command('show-user-uri')
|
||||||
@click.option('--username', '-u', required=True, help='Username for the user to show the URI', type=str)
|
@click.option('--username', '-u', required=True, help='Username for the user to show the URI', type=str)
|
||||||
def show_user_uri(username: str):
|
@click.option('--qrcode', '-qr', is_flag=True, help='Generate QR code for the URI')
|
||||||
run_cmd(['bash', Command.SHOW_USER_URI.value, username])
|
@click.option('--ipv', '-ip', type=click.IntRange(4, 6), default=4, help='IP version (4 or 6)')
|
||||||
|
@click.option('--all', '-a', is_flag=True, help='Show both IPv4 and IPv6 URIs and generate QR codes for both if requested')
|
||||||
|
def show_user_uri(username: str, qrcode: bool, ipv: int, all: bool):
|
||||||
|
command_args = ['bash', Command.SHOW_USER_URI.value, '-u', username]
|
||||||
|
if qrcode:
|
||||||
|
command_args.append('-qr')
|
||||||
|
if all:
|
||||||
|
command_args.append('-a')
|
||||||
|
else:
|
||||||
|
command_args.extend(['-ip', str(ipv)])
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = subprocess.check_output(command_args, shell=False, text=True)
|
||||||
|
print(result.strip())
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(f"Error: {e.output.strip()}")
|
||||||
|
|
||||||
|
|
||||||
@ cli.command('traffic-status')
|
@ cli.command('traffic-status')
|
||||||
|
|||||||
Reference in New Issue
Block a user