Skip to content

Commit

Permalink
Make linter happy and display build states in README
Browse files Browse the repository at this point in the history
  • Loading branch information
SaaldjorMike committed Jul 31, 2020
1 parent e48d37b commit c19155f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 45 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Humio CLI

[![Build Status](https://github.com/humio/cli/workflows/CI/badge.svg)](https://github.com/humio/cli/actions?query=workflow%3ACI)
[![Release Status](https://github.com/humio/cli/workflows/goreleaser/badge.svg)](https://github.com/humio/cli/actions?query=workflow%3Agoreleaser)
[![Go Report Card](https://goreportcard.com/badge/github.com/humio/cli)](https://goreportcard.com/report/github.com/humio/cli)

A CLI for managing and sending data to Humio.

_This repository also contains Humio GoLang API client you can
Expand Down
44 changes: 22 additions & 22 deletions cmd/humioctl/cluster_nodes_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,28 @@ func newClusterNodesShowCmd() *cobra.Command {

func printClusterNodeInfo(cmd *cobra.Command, node api.ClusterNode) {
data := [][]string{
[]string{"ID", strconv.Itoa(node.Id)},
[]string{"Name", node.Name},
[]string{"URI", node.Uri},
[]string{"UUID", node.Uuid},
[]string{"Cluster info age (Seconds)", fmt.Sprintf("%.3f", node.ClusterInfoAgeSeconds)},
[]string{"Inbound segment (Size)", ByteCountDecimal(int64(node.InboundSegmentSize))},
[]string{"Outbound segment (Size)", ByteCountDecimal(int64(node.OutboundSegmentSize))},
[]string{"Storage Divergence (Size)", ByteCountDecimal(int64(node.StorageDivergence))},
[]string{"Can be safely unregistered", strconv.FormatBool(node.CanBeSafelyUnregistered)},
[]string{"Current size", ByteCountDecimal(int64(node.CurrentSize))},
[]string{"Primary size", ByteCountDecimal(int64(node.PrimarySize))},
[]string{"Secondary size", ByteCountDecimal(int64(node.SecondarySize))},
[]string{"Total size of primary", ByteCountDecimal(int64(node.TotalSizeOfPrimary))},
[]string{"Total size of secondary", ByteCountDecimal(int64(node.TotalSizeOfSecondary))},
[]string{"Free on primary", ByteCountDecimal(int64(node.FreeOnPrimary))},
[]string{"Free on secondary", ByteCountDecimal(int64(node.FreeOnSecondary))},
[]string{"WIP size", ByteCountDecimal(int64(node.WipSize))},
[]string{"Target size", ByteCountDecimal(int64(node.TargetSize))},
[]string{"Reapply target size", ByteCountDecimal(int64(node.Reapply_targetSize))},
[]string{"Solitary segment size", ByteCountDecimal(int64(node.SolitarySegmentSize))},
[]string{"Is available", strconv.FormatBool(node.IsAvailable)},
[]string{"Last heartbeat", node.LastHeartbeat},
{"ID", strconv.Itoa(node.Id)},
{"Name", node.Name},
{"URI", node.Uri},
{"UUID", node.Uuid},
{"Cluster info age (Seconds)", fmt.Sprintf("%.3f", node.ClusterInfoAgeSeconds)},
{"Inbound segment (Size)", ByteCountDecimal(int64(node.InboundSegmentSize))},
{"Outbound segment (Size)", ByteCountDecimal(int64(node.OutboundSegmentSize))},
{"Storage Divergence (Size)", ByteCountDecimal(int64(node.StorageDivergence))},
{"Can be safely unregistered", strconv.FormatBool(node.CanBeSafelyUnregistered)},
{"Current size", ByteCountDecimal(int64(node.CurrentSize))},
{"Primary size", ByteCountDecimal(int64(node.PrimarySize))},
{"Secondary size", ByteCountDecimal(int64(node.SecondarySize))},
{"Total size of primary", ByteCountDecimal(int64(node.TotalSizeOfPrimary))},
{"Total size of secondary", ByteCountDecimal(int64(node.TotalSizeOfSecondary))},
{"Free on primary", ByteCountDecimal(int64(node.FreeOnPrimary))},
{"Free on secondary", ByteCountDecimal(int64(node.FreeOnSecondary))},
{"WIP size", ByteCountDecimal(int64(node.WipSize))},
{"Target size", ByteCountDecimal(int64(node.TargetSize))},
{"Reapply target size", ByteCountDecimal(int64(node.Reapply_targetSize))},
{"Solitary segment size", ByteCountDecimal(int64(node.SolitarySegmentSize))},
{"Is available", strconv.FormatBool(node.IsAvailable)},
{"Last heartbeat", node.LastHeartbeat},
}

w := tablewriter.NewWriter(cmd.OutOrStdout())
Expand Down
2 changes: 1 addition & 1 deletion cmd/humioctl/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func sendLine(line string) {

func sendBatch(client *api.Client, repo string, messages []string, fields map[string]string, parserName string) {
lineJSON, err := json.Marshal([1]eventList{
eventList{
{
Type: parserName,
Fields: fields,
Messages: messages,
Expand Down
12 changes: 6 additions & 6 deletions cmd/humioctl/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ func newReposCmd() *cobra.Command {
func printRepoTable(cmd *cobra.Command, repo api.Repository) {

data := [][]string{
[]string{"Name", repo.Name},
[]string{"Description", repo.Description},
[]string{"Space Used", ByteCountDecimal(repo.SpaceUsed)},
[]string{"Ingest Retention (Size)", ByteCountDecimal(int64(repo.IngestRetentionSizeGB * 1e9))},
[]string{"Storage Retention (Size)", ByteCountDecimal(int64(repo.StorageRetentionSizeGB * 1e9))},
[]string{"Retention (Days)", fmt.Sprintf("%d", int64(repo.RetentionDays))},
{"Name", repo.Name},
{"Description", repo.Description},
{"Space Used", ByteCountDecimal(repo.SpaceUsed)},
{"Ingest Retention (Size)", ByteCountDecimal(int64(repo.IngestRetentionSizeGB * 1e9))},
{"Storage Retention (Size)", ByteCountDecimal(int64(repo.StorageRetentionSizeGB * 1e9))},
{"Retention (Days)", fmt.Sprintf("%d", int64(repo.RetentionDays))},
}

w := tablewriter.NewWriter(cmd.OutOrStdout())
Expand Down
16 changes: 8 additions & 8 deletions cmd/humioctl/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ func newSearchCmd() *cobra.Command {
// run in lambda func to be able to defer and delete the query job
err := func() error {
id, err := client.QueryJobs().Create(repository, api.Query{
QueryString: queryString,
Start: start,
End: end,
Live: live,
QueryString: queryString,
Start: start,
End: end,
Live: live,
ShowQueryEventDistribution: true,
})

Expand Down Expand Up @@ -155,10 +155,10 @@ func contextCancelledOnInterrupt(ctx context.Context) context.Context {
}

type queryResultProgressBar struct {
bar *prompt.ProgressBar
epsValue float64
bpsValue float64
hits uint64
bar *prompt.ProgressBar
epsValue float64
bpsValue float64
hits uint64
}

func newQueryResultProgressBar() *queryResultProgressBar {
Expand Down
14 changes: 7 additions & 7 deletions cmd/humioctl/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func formatSimpleAccount(account api.User) string {
func printUserTable(cmd *cobra.Command, user api.User) {

data := [][]string{
[]string{"Username", user.Username},
[]string{"Name", user.FullName},
[]string{"Is Root", yesNo(user.IsRoot)},
[]string{"Email", user.Email},
[]string{"Created At", user.CreatedAt},
[]string{"Country Code", user.CountryCode},
[]string{"Company", user.Company},
{"Username", user.Username},
{"Name", user.FullName},
{"Is Root", yesNo(user.IsRoot)},
{"Email", user.Email},
{"Created At", user.CreatedAt},
{"Country Code", user.CountryCode},
{"Company", user.Company},
}

w := tablewriter.NewWriter(cmd.OutOrStdout())
Expand Down
2 changes: 1 addition & 1 deletion cmd/humioctl/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newViewsCmd() *cobra.Command {
func printViewTable(view *api.View) {

data := [][]string{
[]string{"Name", view.Name},
{"Name", view.Name},
}

w := tablewriter.NewWriter(os.Stdout)
Expand Down

0 comments on commit c19155f

Please sign in to comment.