You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: codegpt/main.py
+75-20Lines changed: 75 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -16,53 +16,99 @@
16
16
17
17
app=typer.Typer()
18
18
19
+
19
20
@app.command("do")
20
21
defedit_file(
21
22
instruction: str=typer.Argument(
22
-
..., help="Instruction to edit the file(s). Keep it short! Wrap with quotes.",
23
+
...,
24
+
help="Instruction to edit the file(s). Keep it short! Wrap with quotes.",
23
25
),
24
26
filenames: List[Path] =typer.Argument(
25
-
[], help="List of filenames to edit. If not provided, will prompt for input.",
27
+
["#CLIPBOARD"],
28
+
help="List of filenames to edit. If not provided, will prompt for input.",
26
29
),
27
30
backup: bool=typer.Option(
28
-
False, "--backup", "-b", help="Whether to create a backup of the original file(s).",
31
+
False,
32
+
"--backup",
33
+
"-b",
34
+
help="Whether to create a backup of the original file(s).",
35
+
),
36
+
yes: bool=typer.Option(
37
+
False,
38
+
"--yes",
39
+
"-y",
40
+
help="Don't ask for confirmation.",
41
+
),
42
+
raw_code: str=typer.Option(
43
+
None,
44
+
"--raw-code",
45
+
"-c",
46
+
help="Raw code to edit. Overrides filenames. Use quotes to wrap the code.",
47
+
),
48
+
json_out: bool=typer.Option(
49
+
False, "--json-out", "-j", help="Output the response in raw json format."
50
+
),
51
+
raw_out: bool=typer.Option(
52
+
False,
53
+
"--raw-out",
54
+
"-r",
55
+
help="Output the raw 'code' from the response and exit the function.",
29
56
),
30
-
yes: bool=typer.Option(False, "--yes", "-y", help="Don't ask for confirmation.",),
31
-
raw_code: str=typer.Option(None, "--raw-code", "-c", help="Raw code to edit. Overrides filenames"),
32
-
json_out: bool=typer.Option(False, "--json-out", "-j", help="Output to raw json."),
33
-
):
57
+
):
34
58
"""
35
59
Do something given some code for context. Asking for documents, queries, etc. should work okay. Edits are iffy, but work a lot of the time.
36
-
37
-
Your code better be in git before you use this.
60
+
61
+
Your code better be in git before you use this. If the instruction is one of the quick prompt options (like 'comment' or 'docs'), it will do that prompt automatically. For more info, run 'codegpt quick --help'.
38
62
39
63
FILENAMES: list of filenames to edit. If not provided, will prompt for input.
40
64
INSTRUCTION: the instruction to edit the file(s). Keep it short!
41
65
"""
42
66
43
67
ifnotfilenamesandnotraw_code:
44
-
raisetyper.BadParameter("Either FILENAMES or --raw-code (-c) must be provided.")
68
+
raisetyper.BadParameter(
69
+
"Either filenames or --raw-code (-c) must be provided."
0 commit comments