Skip to content

Commit

Permalink
fix(text) : prameter -s accepte now one value
Browse files Browse the repository at this point in the history
  • Loading branch information
LordPax committed Sep 28, 2024
1 parent 3d4f7f8 commit bd9183c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Changed

* Parameter -s accepte now one value (breaking change)

## [0.3.0] - 2024-09-28

### Added
Expand Down
21 changes: 8 additions & 13 deletions commands/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,24 @@ func textFlags() []cli.Flag {
return nil
},
},
&cli.StringSliceFlag{
&cli.StringFlag{
Name: "context",
Aliases: []string{"s"},
Usage: l.Get("text-system-usage"),
Category: "text",
Action: func(c *cli.Context, values []string) error {
Action: func(c *cli.Context, value string) error {
text := sdk.GetSdkText()
var content []string

for _, value := range values {
if value == "-" {
stdin, err := io.ReadAll(os.Stdin)
if err != nil {
return err
}

value = string(stdin)
if value == "-" {
stdin, err := io.ReadAll(os.Stdin)
if err != nil {
return err
}

content = append(content, value)
value = string(stdin)
}

text.AppendHistory("system", content...)
text.AppendHistory("system", value)

return nil
},
Expand Down

0 comments on commit bd9183c

Please sign in to comment.