This commit is contained in:
Iris Lightshard 2022-05-29 00:26:36 -06:00
parent b7e2dc3ab7
commit bea90e0e1c
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
6 changed files with 249 additions and 252 deletions

View file

@ -2,9 +2,9 @@ package cmd
import ( import (
"fmt" "fmt"
"strings"
"nilfm.cc/git/quartzgun/auth"
"nilfm.cc/git/nirvash/config" "nilfm.cc/git/nirvash/config"
"nilfm.cc/git/quartzgun/auth"
"strings"
) )
func Process(args []string, userStore auth.UserStore, cfg *config.Config) bool { func Process(args []string, userStore auth.UserStore, cfg *config.Config) bool {

View file

@ -2,11 +2,11 @@ package config
import ( import (
"fmt" "fmt"
"runtime"
"os"
"strings"
"path/filepath"
"nilfm.cc/git/nirvash/adapter" "nilfm.cc/git/nirvash/adapter"
"os"
"path/filepath"
"runtime"
"strings"
) )
type Config struct { type Config struct {
@ -20,7 +20,7 @@ type Config struct {
func GetConfigLocation() string { func GetConfigLocation() string {
home := os.Getenv("HOME") home := os.Getenv("HOME")
appdata := os.Getenv("APPDATA") appdata := os.Getenv("APPDATA")
switch (runtime.GOOS) { switch runtime.GOOS {
case "windows": case "windows":
return filepath.Join(appdata, "nirvash") return filepath.Join(appdata, "nirvash")
case "darwin": case "darwin":
@ -50,7 +50,6 @@ func Write(cfg *Config) error {
return writeConfig(cfg, filepath.Join(GetConfigLocation(), "nirvash.conf")) return writeConfig(cfg, filepath.Join(GetConfigLocation(), "nirvash.conf"))
} }
func SetAdapter(cfg *Config, adptr string) { func SetAdapter(cfg *Config, adptr string) {
switch adptr { switch adptr {
case "eureka": case "eureka":
@ -60,8 +59,6 @@ func SetAdapter(cfg *Config, adptr string) {
} }
} }
func IsNull(cfg *Config) bool { func IsNull(cfg *Config) bool {
return cfg.Adapter == nil || len(cfg.Root) == 0 || len(cfg.StaticRoot) == 0 || len(cfg.AssetRoot) == 0 return cfg.Adapter == nil || len(cfg.Root) == 0 || len(cfg.StaticRoot) == 0 || len(cfg.AssetRoot) == 0
} }
@ -108,7 +105,7 @@ func RunWizard(cfg *Config) {
} }
func ensureNonEmptyOption(buffer *string) { func ensureNonEmptyOption(buffer *string) {
for ;; { for {
fmt.Scanln(buffer) fmt.Scanln(buffer)
if len(strings.TrimSpace(*buffer)) != 0 { if len(strings.TrimSpace(*buffer)) != 0 {
break break

View file

@ -1,15 +1,15 @@
package main package main
import ( import (
"os"
"path/filepath"
"net/http" "net/http"
"nilfm.cc/git/quartzgun/indentalUserDB"
"nilfm.cc/git/quartzgun/router"
"nilfm.cc/git/quartzgun/renderer"
"nilfm.cc/git/quartzgun/middleware"
"nilfm.cc/git/nirvash/cmd" "nilfm.cc/git/nirvash/cmd"
"nilfm.cc/git/nirvash/config" "nilfm.cc/git/nirvash/config"
"nilfm.cc/git/quartzgun/indentalUserDB"
"nilfm.cc/git/quartzgun/middleware"
"nilfm.cc/git/quartzgun/renderer"
"nilfm.cc/git/quartzgun/router"
"os"
"path/filepath"
) )
func main() { func main() {