Fix -o flag

This commit is contained in:
komissarovyv committed 2025-11-01 13:35:00 +03:00
1 parent 915faf6210
commit a42a15d6d6
4 files changed
+10 -7

No files matched your search

+2 -2
View File
@@ -16,9 +16,9 @@ for status in $statusResponse; do
read -ra ADDR <<<"$status" read -ra ADDR <<<"$status"
for module_name in "${ADDR[0]}"; do for module_name in "${ADDR[0]}"; do
if [ -n "$*" ]; then if [ -n "$*" ]; then
ispctl $* schema $module_name -o html > schemas/$module_name.html ispctl $* schema -o html $module_name > schemas/$module_name.html
else else
ispctl schema $module_name -o html > schemas/$module_name.html ispctl schema -o html $module_name > schemas/$module_name.html
fi fi
break break
done done
+3 -1
View File
@@ -132,7 +132,9 @@ func (c Variables) readVariablesFromCsv(filepath string) ([]model.UpsertVariable
if err != nil { if err != nil {
return nil, errors.WithMessagef(err, "failed to open file %s", filepath) return nil, errors.WithMessagef(err, "failed to open file %s", filepath)
} }
defer file.Close() defer func() {
_ = file.Close()
}()
reader := csv.NewReader(file) reader := csv.NewReader(file)
reader.TrimLeadingSpace = true reader.TrimLeadingSpace = true
+1 -1
View File
@@ -69,7 +69,7 @@ func configServiceFromGlobalFlags(ctx *cli.Context) (service.Config, error) {
enableUnsafe := ctx.Bool(command.UnsafeFlagName) enableUnsafe := ctx.Bool(command.UnsafeFlagName)
host := ctx.String(command.HostFlagName) host := ctx.String(command.HostFlagName)
host = strings.Replace(host, "'", "", -1) host = strings.ReplaceAll(host, "'", "")
configCli, err := repository.NewGrpcClientWithHost(host) configCli, err := repository.NewGrpcClientWithHost(host)
if err != nil { if err != nil {
+4 -3
View File
@@ -3,11 +3,12 @@ package repository
import ( import (
"context" "context"
"fmt" "fmt"
epb "google.golang.org/genproto/googleapis/rpc/errdetails"
"ispctl/model" "ispctl/model"
"strings" "strings"
"time" "time"
epb "google.golang.org/genproto/googleapis/rpc/errdetails"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/apierrors" "github.com/txix-open/isp-kit/grpc/apierrors"
"github.com/txix-open/isp-kit/grpc/client" "github.com/txix-open/isp-kit/grpc/client"
@@ -150,8 +151,8 @@ func (c Config) handleVariableError(err error, endpoint string) error {
if apiError == nil { if apiError == nil {
return errors.WithMessagef(err, "call %s", endpoint) return errors.WithMessagef(err, "call %s", endpoint)
} }
switch { switch apiError.ErrorCode {
case apiError.ErrorCode == model.ErrCodeVariableNotFound: case model.ErrCodeVariableNotFound:
return model.ErrVariableNotFound return model.ErrVariableNotFound
default: default:
return errors.WithMessagef(err, "call %s", endpoint) return errors.WithMessagef(err, "call %s", endpoint)