Skip to content

Commit

Permalink
Merge pull request #38 from vcatafesta/main
Browse files Browse the repository at this point in the history
dom 08 out 2023 09:27:34 -04 Vilmar Catafesta ([email protected])
  • Loading branch information
vcatafesta authored Oct 8, 2023
2 parents 658a912 + b2f1d4a commit 38a5493
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 32 deletions.
Binary file modified usr/bin/big-jq
Binary file not shown.
8 changes: 4 additions & 4 deletions usr/share/bigbashview/bcc/shell/bstrlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Description: Big Store installing programs for BigLinux
#
# Created: 2023/08/11
# Altered: 2023/09/25
# Altered: 2023/10/08
#
# Copyright (c) 2023-2023, Vilmar Catafesta <[email protected]>
# All rights reserved.
Expand Down Expand Up @@ -35,7 +35,7 @@
LIB_BSTRLIB_SH=1

APP="${0##*/}"
_VERSION_="1.0.0-20230925"
_VERSION_="1.0.0-20231008"
LOGGER='/dev/tty8'

export HOME_FOLDER="$HOME/.bigstore"
Expand Down Expand Up @@ -243,7 +243,7 @@ function sh_translate_desc {
return 0
fi

if summary=$(trans -no-auto -b :"${lang/_/-}" "$description") && [[ -z "$summary" ]]; then
if summary=$(trans -no-autocorrect -brief :"${lang/_/-}" "$description") && [[ -z "$summary" ]]; then
summary="$description"
updated=0
else
Expand All @@ -256,7 +256,7 @@ function sh_translate_desc {
return 0
fi

if summary=$(trans -no-auto -b :"${lang/_/-}" "$description") && [[ -z "$summary" ]]; then
if summary=$(trans -no-autocorrect -brief :"${lang/_/-}" "$description") && [[ -z "$summary" ]]; then
summary="$description"
updated=0
else
Expand Down
65 changes: 37 additions & 28 deletions usr/src/bigcontrolcenter-base/go/big-jq.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,35 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
"log"
)

const (
_APP_ = "big-jq"
_VERSION_ = "0.7.0-20231007"
_COPY_ = "Copyright (C) 2023 Vilmar Catafesta, <[email protected]>"
)

// Constantes para cores ANSI
const (
Reset = "\x1b[0m"
Red = "\x1b[31m"
Green = "\x1b[32m"
Yellow = "\x1b[33m"
Blue = "\x1b[34m"
Magenta = "\x1b[35m"
Cyan = "\x1b[36m"
White = "\x1b[37m"
Reset = "\x1b[0m"
Red = "\x1b[31m"
Green = "\x1b[32m"
Yellow = "\x1b[33m"
Blue = "\x1b[34m"
Magenta = "\x1b[35m"
Cyan = "\x1b[36m"
White = "\x1b[37m"
)

type Summary struct {
Id_Name string `json:"id_name"`
Name string `json:"name"`
Version string `json:"version"`
Status string `json:"status"`
Size string `json:"size"`
Id_Name string `json:"id_name"`
Name string `json:"name"`
Version string `json:"version"`
Status string `json:"status"`
Size string `json:"size"`
Summary map[string]string `json:"summary"`
}

Expand All @@ -77,16 +83,16 @@ func main() {
}

var (
jsonFile string
id_name string
name string
version string
status string
size string
summary string
lang string
command string // Variável para armazenar o comando encontrado
updated bool
jsonFile string
id_name string
name string
version string
status string
size string
summary string
lang string
command string // Variável para armazenar o comando encontrado
updated bool
)

showJSON := false
Expand Down Expand Up @@ -122,7 +128,7 @@ func main() {
fmt.Println("Uso: big-jq -S|--search] <arquivo_json> <pacote_id> [--json]")
fmt.Println(" big-jq -S|--search] <arquivo_json> <pacote_id.value> [--json]")
fmt.Println(" big-jq -S|--search] <arquivo_json> <pacote_id.subchave.value> [--json]")
os.Exit(1)
os.Exit(1)
}
jsonFile := os.Args[2]
id_name := os.Args[3]
Expand Down Expand Up @@ -184,7 +190,8 @@ func main() {
log.Fatalf("Erro ao escrever no arquivo JSON: %v\n", err)
os.Exit(1)
}
log.Printf("big-jq %sAtualizando arquivo JSON:%s %s\n", Yellow, Reset, jsonFile)
// log.Printf("big-jq %sAtualizando arquivo JSON:%s %s\n", Yellow, Reset, jsonFile)
log.Printf("%s %sSET: %s'%s'%s em %s %s- 200 OK%s\n", _APP_, Green, Yellow, key, Reset, jsonFile, Green, Reset)
os.Exit(0)
}
log.Printf("big-jq %sNada a ser feito no arquivo JSON:%s %s\n", Yellow, Reset, jsonFile)
Expand Down Expand Up @@ -257,11 +264,13 @@ func searchAndPrintSummary(jsonFile, fieldPath string, showJSON bool) {
// Procura o campo especificado
fieldVal := getField(summarys, fields)
if fieldVal != nil {
log.Printf("big-jq %sProcurando:%s'%s'%s %s- 200 OK%s\n", Red, Yellow, strings.TrimSpace(fieldPath), Reset, Cyan, Reset)
log.Printf("%s %sGET: %s'%s'%s em %s %s- 200 OK%s\n", _APP_, Green, Yellow, strings.TrimSpace(fieldPath), Reset, jsonFile, Green, Reset)
// log.Println(_APP_, "GET:", jsonFile, Yellow, strings.TrimSpace(fieldPath), Green, "- 200 OK", Reset)
fmt.Println(fieldVal)
os.Exit(0)
}
log.Printf("big-jq %sProcurando:%s'%s'%s %s- 404 NOK%s\n", Red, Yellow, strings.TrimSpace(fieldPath), Reset, Red, Reset)
log.Printf("%s %sGET: %s'%s'%s em %s %s- 404 NOK%s\n", _APP_, Red, Yellow, strings.TrimSpace(fieldPath), Reset, jsonFile, Red, Reset)
// log.Println(_APP_, Red, "GET:", Cyan, strings.TrimSpace(fieldPath), Reset, "em", jsonFile, "-", Red, "200 NOK", Reset)
fmt.Println("null")
os.Exit(1)
}
Expand Down

0 comments on commit 38a5493

Please sign in to comment.