Skip to content

Commit

Permalink
Improved the help screens.
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Apr 6, 2024
1 parent 98a86a1 commit 0e13270
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
18 changes: 18 additions & 0 deletions cmd/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2023–2024, Northwood Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*
Package cmd contains the command-line interface (CLI) for the ssm-shell binary.
*/
package cmd
9 changes: 0 additions & 9 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ var (
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("240"))

helpText = lipgloss.NewStyle().
Border(lipgloss.RoundedBorder()).
BorderForeground(lipgloss.Color("99")).
Padding(1, 2) // lint:allow_raw_number

style = lipgloss.NewStyle().
Bold(true).
Border(lipgloss.RoundedBorder())

logger = log.NewWithOptions(os.Stderr, log.Options{
ReportTimestamp: true,
TimeFormat: time.Kitchen,
Expand Down
14 changes: 12 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ import (
)

var (
helpText = lipgloss.NewStyle().
Border(lipgloss.RoundedBorder()).
BorderForeground(lipgloss.Color("99")).
Padding(1, 2) // lint:allow_raw_number

headerStyle = lipgloss.NewStyle().
Bold(true).
Border(lipgloss.RoundedBorder()).
Padding(0, 1) // lint:allow_raw_number

// Version represents the version of the software.
Version = "dev"

Expand All @@ -49,7 +59,7 @@ var (
Long: helpText.Render(`Long-form version information, including the build commit hash, build date, Go
version, and external dependencies.`),
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(style.Render(" BUILD INFO "))
fmt.Println(headerStyle.Render("BUILD INFO"))

t := table.New().
Border(lipgloss.RoundedBorder()).
Expand Down Expand Up @@ -79,7 +89,7 @@ version, and external dependencies.`),
//----------------------------------------------------------------------

if buildInfo, ok := debug.ReadBuildInfo(); ok {
fmt.Println(style.Render(" DEPENDENCIES "))
fmt.Println(headerStyle.Render("DEPENDENCIES"))

td := table.New().
Border(lipgloss.RoundedBorder()).
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/lithammer/dedent v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY=
github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
Expand Down

0 comments on commit 0e13270

Please sign in to comment.