Skip to content

Commit

Permalink
IMPROVEMENT-12: Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
grafviktor committed Nov 25, 2023
1 parent 6198320 commit 6351ae5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/ui/component/edithost/edit_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func New(ctx context.Context, storage storage.HostStorage, state *state.Applicat
case 3:
t.Label = "Login"
t.CharLimit = 128
t.Placeholder = fmt.Sprintf("default: %s", utils.CurrentOSUsername())
t.Placeholder = fmt.Sprintf("default: %s", utils.CurrentUsername())
t.SetValue(host.LoginName)
case 4:
t.Label = "Port"
Expand Down
4 changes: 2 additions & 2 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func AppDir(appName, userDefinedPath string) (string, error) {
return path.Join(userConfigDir, appName), nil
}

// CurrentOSUsername - returns current OS username or "n/a" if it can't be determined.
func CurrentOSUsername() string {
// CurrentUsername - returns current OS username or "n/a" if it can't be determined.
func CurrentUsername() string {
user, err := user.Current()
if err != nil {
return "n/a"
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Test_GetAppDir(t *testing.T) {
}

func Test_GetCurrentOSUser(t *testing.T) {
username := CurrentOSUsername()
username := CurrentUsername()
require.NotEmpty(t, username, "GetCurrentOSUser should return a non-empty string")
}

Expand Down

0 comments on commit 6351ae5

Please sign in to comment.