github.com/jbendotnet/noms@v0.0.0-20190904222105-c43e4293ea92/cmd/noms/noms_config.go (about)

     1  // Copyright 2016 Attic Labs, Inc. All rights reserved.
     2  // Licensed under the Apache License, version 2.0:
     3  // http://www.apache.org/licenses/LICENSE-2.0
     4  
     5  package main
     6  
     7  import (
     8  	"fmt"
     9  	"os"
    10  
    11  	"github.com/attic-labs/kingpin"
    12  	"github.com/attic-labs/noms/cmd/util"
    13  	"github.com/attic-labs/noms/go/config"
    14  	"github.com/attic-labs/noms/go/d"
    15  )
    16  
    17  func nomsConfig(noms *kingpin.Application) (*kingpin.CmdClause, util.KingpinHandler) {
    18  	cfg := noms.Command("config", "Display noms config info.")
    19  
    20  	return cfg, func(input string) int {
    21  		c, err := config.FindNomsConfig()
    22  		if err == config.NoConfig {
    23  			fmt.Fprintf(os.Stdout, "no config active\n")
    24  		} else {
    25  			d.CheckError(err)
    26  			fmt.Fprintf(os.Stdout, "%s\n", c.String())
    27  		}
    28  		return 0
    29  	}
    30  }