mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-02 02:25:31 +08:00
Update HELP command of ADMIN CLI (#12387)
### What problem does this PR solve? As title. ### Type of change - [x] Refactoring Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@ -300,6 +300,43 @@ def encode_to_base64(input_string):
|
|||||||
return base64_encoded.decode("utf-8")
|
return base64_encoded.decode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
def show_help():
|
||||||
|
"""Help info"""
|
||||||
|
help_text = """
|
||||||
|
Commands:
|
||||||
|
LIST SERVICES
|
||||||
|
SHOW SERVICE <service>
|
||||||
|
STARTUP SERVICE <service>
|
||||||
|
SHUTDOWN SERVICE <service>
|
||||||
|
RESTART SERVICE <service>
|
||||||
|
LIST USERS
|
||||||
|
SHOW USER <user>
|
||||||
|
DROP USER <user>
|
||||||
|
CREATE USER <user> <password>
|
||||||
|
ALTER USER PASSWORD <user> <new_password>
|
||||||
|
ALTER USER ACTIVE <user> <on/off>
|
||||||
|
LIST DATASETS OF <user>
|
||||||
|
LIST AGENTS OF <user>
|
||||||
|
CREATE ROLE <role>
|
||||||
|
DROP ROLE <role>
|
||||||
|
ALTER ROLE <role> SET DESCRIPTION <description>
|
||||||
|
LIST ROLES
|
||||||
|
SHOW ROLE <role>
|
||||||
|
GRANT <action_list> ON <function> TO ROLE <role>
|
||||||
|
REVOKE <action_list> ON <function> TO ROLE <role>
|
||||||
|
ALTER USER <user> SET ROLE <role>
|
||||||
|
SHOW USER PERMISSION <user>
|
||||||
|
SHOW VERSION
|
||||||
|
GRANT ADMIN <user>
|
||||||
|
REVOKE ADMIN <user>
|
||||||
|
|
||||||
|
Meta Commands:
|
||||||
|
\\?, \\h, \\help Show this help
|
||||||
|
\\q, \\quit, \\exit Quit the CLI
|
||||||
|
"""
|
||||||
|
print(help_text)
|
||||||
|
|
||||||
|
|
||||||
class AdminCLI(Cmd):
|
class AdminCLI(Cmd):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -918,36 +955,12 @@ class AdminCLI(Cmd):
|
|||||||
args = command.get("args", [])
|
args = command.get("args", [])
|
||||||
|
|
||||||
if meta_command in ["?", "h", "help"]:
|
if meta_command in ["?", "h", "help"]:
|
||||||
self.show_help()
|
show_help()
|
||||||
elif meta_command in ["q", "quit", "exit"]:
|
elif meta_command in ["q", "quit", "exit"]:
|
||||||
print("Goodbye!")
|
print("Goodbye!")
|
||||||
else:
|
else:
|
||||||
print(f"Meta command '{meta_command}' with args {args}")
|
print(f"Meta command '{meta_command}' with args {args}")
|
||||||
|
|
||||||
def show_help(self):
|
|
||||||
"""Help info"""
|
|
||||||
help_text = """
|
|
||||||
Commands:
|
|
||||||
LIST SERVICES
|
|
||||||
SHOW SERVICE <service>
|
|
||||||
STARTUP SERVICE <service>
|
|
||||||
SHUTDOWN SERVICE <service>
|
|
||||||
RESTART SERVICE <service>
|
|
||||||
LIST USERS
|
|
||||||
SHOW USER <user>
|
|
||||||
DROP USER <user>
|
|
||||||
CREATE USER <user> <password>
|
|
||||||
ALTER USER PASSWORD <user> <new_password>
|
|
||||||
ALTER USER ACTIVE <user> <on/off>
|
|
||||||
LIST DATASETS OF <user>
|
|
||||||
LIST AGENTS OF <user>
|
|
||||||
|
|
||||||
Meta Commands:
|
|
||||||
\\?, \\h, \\help Show this help
|
|
||||||
\\q, \\quit, \\exit Quit the CLI
|
|
||||||
"""
|
|
||||||
print(help_text)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
Reference in New Issue
Block a user