Skip to content

Username config#41

Merged
bohendo merged 9 commits intomainfrom
username-config
Mar 15, 2024
Merged

Username config#41
bohendo merged 9 commits intomainfrom
username-config

Conversation

@bohendo
Copy link
Copy Markdown
Collaborator

@bohendo bohendo commented Mar 15, 2024

Get username from a config file instead of from the environment. The current user's username is used as the default suggestion during cloudexec configure so you can just press enter through that to easily use your username.

resolves #36

Summary by CodeRabbit

  • Refactor: Updated the method of retrieving the current user's username from the system, now using it as the default value during configuration. This change enhances reliability and consistency.
  • New Feature: Introduced a new function getSSHDir() to encapsulate the logic for obtaining the SSH directory path, improving code modularity.
  • Refactor: Simplified the Launch function signature by removing the user *user.User parameter, enhancing readability and maintainability.
  • Refactor: Removed dependency on the os/user package in cmd/cloudexec/configure.go and cmd/cloudexec/launch.go, reducing external dependencies.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 15, 2024

Image description CodeRabbit

Walkthrough

The changes primarily focus on the way the current user's username is retrieved and used. The os/user package dependency has been removed, and the username is now directly obtained from the configuration. This change affects multiple functions' signatures and introduces a new function to get the SSH directory path.

Changes

Files Summary
cmd/cloudexec/configure.go, cmd/cloudexec/launch.go The diff modifies how the current user's username is retrieved and used as the default value during configuration. The configValues struct now includes the Username field. The Launch function signature has been modified, and the ssh package functions are now called without the user parameter.
pkg/config/config.go, pkg/ssh/ssh.go The signatures of exported functions have been changed by removing the usr *user.User parameter and using user.Current() internally. A new function getSSHDir() has been introduced to encapsulate the logic for obtaining the SSH directory path.

"With each commit we make, our code takes shape 🐇💻

Like a sculptor with clay, we refine and reshape 🎨🖌️

From os/user we part, for a simpler start 🏞️🚀

In the world of code, every change is an art! 🌟🎭"


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 9d3aa08 and 801e379 commits.
Files selected (5)
  • cmd/cloudexec/configure.go (1)
  • cmd/cloudexec/launch.go (4)
  • cmd/cloudexec/main.go (14)
  • pkg/config/config.go (1)
  • pkg/ssh/ssh.go (5)
Files not summarized due to errors (1)
  • cmd/cloudexec/main.go (diff tokens exceeds limit)
Review comments generated (25)
  • Review: 4
  • LGTM: 21

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@bohendo bohendo merged commit 5604787 into main Mar 15, 2024
@bohendo bohendo deleted the username-config branch March 15, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read username from config, not from the system environment

1 participant