Skip to content

Commit

Permalink
ren packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Sep 2, 2024
1 parent 5f4c3d4 commit ef88ccf
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 137 deletions.
4 changes: 2 additions & 2 deletions command/command.go → flags/flags.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Package command provides the command line interface for the Defacto2 server application.
// Package flags provides the command line interface for the Defacto2 server application.
// With the configuration of the application done using the environment variables,
// the use of commands should be kept to a minimum.
package command
package flags

import (
"errors"
Expand Down
12 changes: 6 additions & 6 deletions command/command_test.go → flags/flags_test.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package command_test
package flags_test

import (
"testing"

"github.com/Defacto2/server/command"
"github.com/Defacto2/server/flags"
"github.com/Defacto2/server/internal/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestRun(t *testing.T) {
t.Parallel()
ec, err := command.Run("", nil)
ec, err := flags.Run("", nil)
require.Error(t, err)
assert.Equal(t, command.UsageError, ec)
assert.Equal(t, flags.UsageError, ec)
c := config.Config{}
ec, err = command.Run("", &c)
ec, err = flags.Run("", &c)
require.Error(t, err)
assert.Equal(t, command.GenericError, ec)
assert.Equal(t, flags.GenericError, ec)
}
8 changes: 4 additions & 4 deletions handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"time"

"github.com/Defacto2/helper"
"github.com/Defacto2/server/command"
"github.com/Defacto2/server/flags"
"github.com/Defacto2/server/handler/app"
"github.com/Defacto2/server/handler/download"
"github.com/Defacto2/server/handler/html3"
Expand Down Expand Up @@ -150,15 +150,15 @@ func (c Configuration) Info(logger *zap.SugaredLogger, w io.Writer) {
fmt.Fprint(w, "\n\n")
}

fmt.Fprintf(w, " %s.\n", command.Copyright())
fmt.Fprintf(w, " %s.\n", flags.Copyright())
fmt.Fprintf(w, "%s\n", c.versionBrief())

cpuInfo := fmt.Sprintf(" %d active routines sharing %d usable threads on %d CPU cores.",
runtime.NumGoroutine(), runtime.GOMAXPROCS(-1), runtime.NumCPU())
fmt.Fprintln(w, cpuInfo)

golangInfo := fmt.Sprintf(" Compiled on Go %s for %s with %s.\n",
runtime.Version()[2:], command.OS(), command.Arch())
runtime.Version()[2:], flags.OS(), flags.Arch())
fmt.Fprintln(w, golangInfo)
//
// All additional feedback should go in internal/config/check.go (c *Config) Checks()
Expand Down Expand Up @@ -380,7 +380,7 @@ func (c Configuration) versionBrief() string {
if c.Version == "" {
return " no version info, app compiled binary directly."
}
return fmt.Sprintf(" %s.", command.Commit(c.Version))
return fmt.Sprintf(" %s.", flags.Commit(c.Version))
}

// Rewrites for assets.
Expand Down
Loading

0 comments on commit ef88ccf

Please sign in to comment.