An open API service indexing awesome lists of open source software.

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

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

```

---
![Logo](https://raw.githubusercontent.com/Benny121221/images/master/logo_full.png)

# Made by Where 1