Skip to content

Commit d40c9f4

Browse files
committed
feat: parse subject ids with spaces in odc-cli
1 parent e466025 commit d40c9f4

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

cli/odc-cli

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ from argparse import (
2222
from datetime import datetime
2323
from typing import Any, Callable, TypedDict
2424
from urllib.error import HTTPError, URLError
25-
from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
25+
from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse, quote
2626
from urllib.request import Request, urlopen
2727
from urllib.response import addinfourl
2828

@@ -388,9 +388,18 @@ class SubjectCommands:
388388
@require_token
389389
@staticmethod
390390
def delete(id: str) -> None:
391-
url = f'{config.base_url}/v1/subjects/{id}'
392-
response = HttpClient.delete(url)
393-
print(response)
391+
entry = input("Are you sure you want to delete this subject? Type DELETE to Confirm: ")
392+
if(entry == "DELETE"):
393+
url =build_url_with_params(
394+
f'{config.base_url}' + quote(f'/v1/subjects/{id}', safe='/'),
395+
{
396+
'force': True
397+
}
398+
)
399+
response = HttpClient.delete(url)
400+
print(response)
401+
else:
402+
print("Cancelling delete command")
394403

395404
@require_url
396405
@require_token

0 commit comments

Comments
 (0)