We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1eccbef commit 3525df4Copy full SHA for 3525df4
src/gptcmd/cli.py
@@ -780,18 +780,13 @@ def do_read(self, arg):
780
example: "read /path/to/prompt.txt system"
781
"""
782
args = arg.split()
783
- if len(args) < 2:
+ if len(args) < 2 or not self.__class__._validate_role(args[-1]):
784
print(
785
- "Usage: read <path> <{'|'.join(self.__class__.KNOWN_ROLES)}>"
+ f"Usage: read <path> <{'|'.join(self.__class__.KNOWN_ROLES)}>"
786
)
787
return
788
path = " ".join(args[:-1])
789
role = args[-1]
790
- if not self.__class__._validate_role(role):
791
- print(
792
- f"Usage: read <path> <{'|'.join(self.__class__.KNOWN_ROLES)}>"
793
- )
794
- return
795
try:
796
with open(path, encoding="utf-8", errors="ignore") as fin:
797
self._current_thread.append(
0 commit comments