feat: Add CLI command to edit NormalSub subpath
- Added `edit_normalsub_subpath` function to `cli_api.py` to
interact with the `normalsub.sh edit_subpath` command, including
input validation for the new subpath.
- Updated the `normal-sub` command in `cli.py`:
- Added 'edit_subpath' as a valid action.
- Introduced a '--subpath' option for specifying the new path.
- Modified the command logic to call the new API function when
the 'edit_subpath' action is selected.
This commit is contained in:
@ -510,6 +510,14 @@ def start_normalsub(domain: str, port: int):
|
||||
raise InvalidInputError('Error: Both --domain and --port are required for the start action.')
|
||||
run_cmd(['bash', Command.INSTALL_NORMALSUB.value, 'start', domain, str(port)])
|
||||
|
||||
def edit_normalsub_subpath(new_subpath: str):
|
||||
'''Edits the subpath for NormalSub service.'''
|
||||
if not new_subpath:
|
||||
raise InvalidInputError('Error: New subpath cannot be empty.')
|
||||
if not new_subpath.isalnum():
|
||||
raise InvalidInputError('Error: New subpath must contain only alphanumeric characters (a-z, A-Z, 0-9).')
|
||||
|
||||
run_cmd(['bash', Command.INSTALL_NORMALSUB.value, 'edit_subpath', new_subpath])
|
||||
|
||||
def stop_normalsub():
|
||||
'''Stops NormalSub.'''
|
||||
|
||||
Reference in New Issue
Block a user