Skip to content

Commit

Permalink
feat: move width out of globals
Browse files Browse the repository at this point in the history
  • Loading branch information
RoseSecurity committed Nov 1, 2024
1 parent 6aacedd commit 0a087a3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmd/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (

const atmosDocsURL = "https://atmos.tools"

var width uint

// docsCmd opens the Atmos docs and can display component documentation
var docsCmd = &cobra.Command{
Use: "docs",
Expand All @@ -42,6 +40,7 @@ var docsCmd = &cobra.Command{
}

// Detect terminal width if width flag is not set
width, _ := cmd.Flags().GetUint("width")
if !cmd.Flags().Changed("width") {
if term.IsTerminal(int(os.Stdout.Fd())) {
w, _, err := term.GetSize(int(os.Stdout.Fd()))
Expand Down Expand Up @@ -123,5 +122,5 @@ var docsCmd = &cobra.Command{

func init() {
RootCmd.AddCommand(docsCmd)
docsCmd.Flags().UintVarP(&width, "width", "w", 0, "Set word-wrap width (0 disables word wrapping). Influences output formatting, particularly for tables.")
docsCmd.Flags().UintP("width", "w", 0, "Set word-wrap width (0 disables word wrapping). Influences output formatting, particularly for tables.")
}

0 comments on commit 0a087a3

Please sign in to comment.