https://github.com/bclehmann/configurepowershell
A command-line tool for creating a PowerShell profile
https://github.com/bclehmann/configurepowershell
cli config configuration powershell python
Last synced: 4 months ago
JSON representation
A command-line tool for creating a PowerShell profile
- Host: GitHub
- URL: https://github.com/bclehmann/configurepowershell
- Owner: bclehmann
- License: mit
- Created: 2020-08-07T08:00:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-07T21:28:12.000Z (over 5 years ago)
- Last Synced: 2025-02-28T09:19:57.529Z (12 months ago)
- Topics: cli, config, configuration, powershell, python
- Language: PowerShell
- Homepage:
- Size: 619 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ConfigurePowershell
A command-line tool for creating a PowerShell profile
## Demonstration
Before doing anything, run `ConfigurePowershell.py`, this will create a config file in the same directory as it. Edit the config file as appropriate.
The `profile_filepath` can be found by typing `$profile` into a powershell window and copy-pasting the result. Once you've modified the config file run `ConfigurePowershell.py` again.
A `config.json` file like this:
```
{
"profile_filepath": "C:/Users/benny/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1",
"git_branch_prompt": true,
"aliases": [
["g", "git"],
["py", "python3"]
]
}
```
Will yield a powershell profile like this:
```ps1
# Put any of your own custom code outside the code block below
# WHERE1 AUTOGENERATED CODE BEGIN
function prompt{
$host.ui.rawui.WindowTitle = $(get-location)
if(Test-Path .git) {
git branch | foreach {
if ($_ -match "^\*(.*)"){
Write-Host ($matches[1] + " ") -NoNewline -ForegroundColor Yellow
}
}
}
Write-Host ($pwd.path + ">") -NoNewline
return " " # Don't want to return anything, or it will be written too
# However, you need to return a string
}
Set-Alias g git
Set-Alias py python3
# WHERE1 AUTOGENERATED CODE END
```
---

# Made by Where 1