Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitAuto: [FEATURE] Add Command to Set Environment Variable #67

Closed

Conversation

gitauto-ai[bot]
Copy link
Contributor

@gitauto-ai gitauto-ai bot commented Oct 8, 2024

Resolves #38

What is the feature

The feature is a new command for a .NET tool project that allows users to set environment variables via the command-line interface (CLI). The command will accept two arguments: the variable value (required) and an optional target specifying where the variable should be set (User or Machine scope).

Why we need the feature

This feature is needed to simplify environment setup, especially in CI/CD pipelines or automated scripts. It provides flexibility by allowing users to specify the target scope (User or Machine) for the environment variable, making it easier to manage environment configurations programmatically.

How to implement and why

  1. Create a new command in the CLI tool:

    • Implement a command that parses input arguments to extract the environment variable name, value, and target scope.
    • Use the Environment.SetEnvironmentVariable method to set the variable, with the target defaulting to User if not specified.
  2. Handle input validation:

    • Ensure the input format is correct (e.g., VAR_NAME=value).
    • Validate the target scope to be either User or Machine.
  3. Implement platform-specific logic:

    • Since setting environment variables is platform-dependent, ensure the feature is implemented for platforms that support it, such as Windows using EnvironmentVariableTarget.
  4. Provide feedback to the user:

    • Output a confirmation message indicating the environment variable has been set, including the target scope.
  5. Update documentation:

    • Add usage examples and detailed instructions in the README or relevant documentation files.

About backward compatibility

This feature is an addition and does not affect existing functionality, so backward compatibility is maintained. The default behavior of setting the environment variable for the current user ensures that existing workflows remain unchanged unless explicitly modified by the user.

Test these changes locally

git checkout -b gitauto/issue-#38-548a3929-7059-4b85-ab6e-b0541d2f7f11
git pull origin gitauto/issue-#38-548a3929-7059-4b85-ab6e-b0541d2f7f11

@github-actions github-actions bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 8, 2024
@gstraccini gstraccini bot added enhancement New feature or request good first issue Good for newcomers hacktoberfest Participation in the Hacktoberfest event help wanted Extra attention is needed 📝 documentation Tasks related to writing or updating documentation 🕓 medium effort A task that can be completed in a few hours 🧪 tests Tasks related to testing labels Oct 8, 2024
@gstraccini gstraccini bot requested a review from guibranco October 8, 2024 16:34
@gstraccini gstraccini bot added 🚦 awaiting triage Items that are awaiting triage or categorization 🤖 bot Automated processes or integrations labels Oct 8, 2024
Copy link

deepsource-io bot commented Oct 8, 2024

Here's the code health analysis summary for commits ce61568..f3b98c9. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Shell LogoShell✅ SuccessView Check ↗
DeepSource Test coverage LogoTest coverage❌ Failure
❗ 1 occurence introduced
View Check ↗
DeepSource Secrets LogoSecrets✅ SuccessView Check ↗
DeepSource Docker LogoDocker✅ SuccessView Check ↗
DeepSource C# LogoC#❌ Failure
❗ 2 occurences introduced
View Check ↗

Code Coverage Report

MetricAggregateC#
Branch Coverage6.1% (down 1% from main)6.1% (down 1% from main)
Condition Coverage6.1% (down 1% from main)6.1% (down 1% from main)
Composite Coverage7.5% (down 0.8% from main)7.5% (down 0.8% from main)
Line Coverage7.9% (down 0.7% from main)7.9% (down 0.7% from main)
New Branch Coverage0%0%
New Condition Coverage0%0%
New Composite Coverage0%0%
New Line Coverage0%0%

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link
Contributor

github-actions bot commented Oct 8, 2024

Infisical secrets check: ✅ No secrets leaked!

💻 Scan logs
11:20PM INF scanning for exposed secrets...
11:20PM INF 57 commits scanned.
11:20PM INF scan completed in 82.8ms
11:20PM INF no leaks found

@guibranco guibranco closed this Oct 9, 2024
@guibranco guibranco deleted the gitauto/issue-#38-548a3929-7059-4b85-ab6e-b0541d2f7f11 branch October 9, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚦 awaiting triage Items that are awaiting triage or categorization 🤖 bot Automated processes or integrations 📝 documentation Tasks related to writing or updating documentation enhancement New feature or request good first issue Good for newcomers hacktoberfest Participation in the Hacktoberfest event help wanted Extra attention is needed 🕓 medium effort A task that can be completed in a few hours size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 🧪 tests Tasks related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Command to Set Environment Variable
1 participant