github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/config/handle_edit.go (about)

     1  package configPkg
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config"
     7  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger"
     8  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output"
     9  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils"
    10  )
    11  
    12  func (opts *ConfigOptions) HandleEdit(rCtx *output.RenderCtx) error {
    13  	if opts.Globals.TestMode {
    14  		logger.Info("Can not process this command in test mode.")
    15  		return nil
    16  	}
    17  
    18  	editor := os.Getenv("EDITOR")
    19  	configFile := config.PathToConfigFile()
    20  	utils.System(editor + " \"" + configFile + "\"")
    21  	return nil
    22  }