Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
39bb25d5
Unverified
Commit
39bb25d5
authored
Jul 29, 2023
by
Patrick Devine
Committed by
GitHub
Jul 29, 2023
Browse files
allow multiline text using three double-quotes (#239)
parent
eadee468
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
cmd/cmd.go
cmd/cmd.go
+19
-0
No files found.
cmd/cmd.go
View file @
39bb25d5
...
@@ -358,6 +358,9 @@ func generateInteractive(cmd *cobra.Command, model string) error {
...
@@ -358,6 +358,9 @@ func generateInteractive(cmd *cobra.Command, model string) error {
}
}
defer
scanner
.
Close
()
defer
scanner
.
Close
()
var
multiLineBuffer
string
var
isMultiLine
bool
for
{
for
{
line
,
err
:=
scanner
.
Readline
()
line
,
err
:=
scanner
.
Readline
()
switch
{
switch
{
...
@@ -376,6 +379,22 @@ func generateInteractive(cmd *cobra.Command, model string) error {
...
@@ -376,6 +379,22 @@ func generateInteractive(cmd *cobra.Command, model string) error {
line
=
strings
.
TrimSpace
(
line
)
line
=
strings
.
TrimSpace
(
line
)
switch
{
switch
{
case
isMultiLine
:
if
strings
.
HasSuffix
(
line
,
`"""`
)
{
isMultiLine
=
false
multiLineBuffer
+=
strings
.
TrimSuffix
(
line
,
`"""`
)
line
=
multiLineBuffer
multiLineBuffer
=
""
scanner
.
SetPrompt
(
">>> "
)
}
else
{
multiLineBuffer
+=
line
+
" "
continue
}
case
strings
.
HasPrefix
(
line
,
`"""`
)
:
isMultiLine
=
true
multiLineBuffer
=
strings
.
TrimPrefix
(
line
,
`"""`
)
+
" "
scanner
.
SetPrompt
(
"... "
)
continue
case
strings
.
HasPrefix
(
line
,
"/list"
)
:
case
strings
.
HasPrefix
(
line
,
"/list"
)
:
args
:=
strings
.
Fields
(
line
)
args
:=
strings
.
Fields
(
line
)
if
err
:=
ListHandler
(
cmd
,
args
[
1
:
]);
err
!=
nil
{
if
err
:=
ListHandler
(
cmd
,
args
[
1
:
]);
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment