Resolve versions in plugin manager

This commit is contained in:
Zachary Yedidia
2019-02-04 22:26:06 -05:00
parent cf2d5dbfe2
commit 4497daaef1
7 changed files with 71 additions and 32 deletions

View File

@@ -3,6 +3,8 @@ package main
import (
"log"
"os"
"github.com/zyedidia/micro/internal/util"
)
// NullWriter simply sends writes into the void
@@ -15,7 +17,7 @@ func (NullWriter) Write(data []byte) (n int, err error) {
// InitLog sets up the debug log system for micro if it has been enabled by compile-time variables
func InitLog() {
if Debug == "ON" {
if util.Debug == "ON" {
f, err := os.OpenFile("log.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)

View File

@@ -13,21 +13,11 @@ import (
"github.com/zyedidia/micro/internal/buffer"
"github.com/zyedidia/micro/internal/config"
"github.com/zyedidia/micro/internal/screen"
"github.com/zyedidia/micro/internal/util"
"github.com/zyedidia/tcell"
)
var (
// These variables should be set by the linker when compiling
// Version is the version number or commit hash
Version = "0.0.0-unknown"
// CommitHash is the commit this version was built on
CommitHash = "Unknown"
// CompileDate is the date this binary was compiled on
CompileDate = "Unknown"
// Debug logging
Debug = "ON"
// Event channel
events chan tcell.Event
autosave chan bool
@@ -70,9 +60,9 @@ func InitFlags() {
if *flagVersion {
// If -version was passed
fmt.Println("Version:", Version)
fmt.Println("Commit hash:", CommitHash)
fmt.Println("Compiled on", CompileDate)
fmt.Println("Version:", util.Version)
fmt.Println("Commit hash:", util.CommitHash)
fmt.Println("Compiled on", util.CompileDate)
os.Exit(0)
}