forked from jstaf/onedriver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial ui * start writing dir chooser * make dir chooser functional * remove pointless gtk.Init call * move main.go to cmd/ * tests! * move systemd stuff to own package * failing tests for systemd unit functions * unit enabling/disabling now works * UnitIsActive now works * finish ui buttons * fix mountpointisvalid * check for mountpoints on startup * row-activated now can get mount name * feature parity with C UI * remove c ui code * enable ui tests (minus systemd/dbus stuff) * local test fixes * disable CGo for UI tests * disable dir_chooser.go for tests * double ci timeout * better test feedback * fix version injection into cli, add more logging to ui * update package build files * faster ui tests in ci * fix by use shell
- Loading branch information
Showing
27 changed files
with
827 additions
and
1,521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// common functions used by both binaries | ||
package common | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/rs/zerolog" | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
const version = "0.12.0" | ||
|
||
var commit string | ||
|
||
// Version returns the current version string | ||
func Version() string { | ||
clen := 0 | ||
if len(commit) > 7 { | ||
clen = 8 | ||
} | ||
return fmt.Sprintf("v%s %s", version, commit[:clen]) | ||
} | ||
|
||
// StringToLevel converts a string to a LogLevel in a case-insensitive manner. | ||
func StringToLevel(level string) zerolog.Level { | ||
level = strings.ToLower(level) | ||
switch level { | ||
case "fatal": | ||
return zerolog.FatalLevel | ||
case "error": | ||
return zerolog.ErrorLevel | ||
case "warn": | ||
return zerolog.WarnLevel | ||
case "info": | ||
return zerolog.InfoLevel | ||
case "debug": | ||
return zerolog.DebugLevel | ||
case "trace": | ||
return zerolog.TraceLevel | ||
default: | ||
log.Error().Msgf("Unrecognized log level \"%s\", defaulting to \"trace\".\n", level) | ||
return zerolog.TraceLevel | ||
} | ||
} |
Oops, something went wrong.