Skip to content

Commit

Permalink
fix: don't load program from filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Jan 9, 2023
1 parent da7c1c2 commit eaef7b3
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions x/logic/client/cli/query_ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package cli
import (
"context"
"fmt"
"io"
"os"
"strings"

"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -36,11 +34,7 @@ $ %s %s query ask "immortal(X)." program.txt
clientCtx := client.GetClientContextFromCmd(cmd)

query := args[0]
program, err := ReadProgramFromFile(args[1])

if err != nil {
return err
}
program := args[1]

queryClient := types.NewQueryServiceClient(clientCtx)

Expand All @@ -60,21 +54,3 @@ $ %s %s query ask "immortal(X)." program.txt

return cmd
}

// ReadProgramFromFile read text from the given filename. Can pass "-" to read from stdin.
func ReadProgramFromFile(filename string) (v string, err error) {
var bytes []byte

if filename == "-" {
bytes, err = io.ReadAll(os.Stdin)
} else {
bytes, err = os.ReadFile(filename)
}

if err != nil {
return
}

v = string(bytes)
return
}

0 comments on commit eaef7b3

Please sign in to comment.