Skip to content

Instantly share code, notes, and snippets.

@oskardotglobal
Last active December 29, 2024 15:13
Show Gist options
  • Save oskardotglobal/e1966ec6062724548b4d57a244cbb26f to your computer and use it in GitHub Desktop.
Save oskardotglobal/e1966ec6062724548b4d57a244cbb26f to your computer and use it in GitHub Desktop.

For educational reasons only, please do not use Windows.

Install by running

irm "https://gist.github.com/oskardotglobal/e1966ec6062724548b4d57a244cbb26f/raw/80339f4bffbdd87b121c35d9e266b752e59c9d76/clang-mommy.ps1" | iex

inside a powershell window.

You may have to change your execution policy first.

# cargo-mommy config, see docs
# $Env:CARGO_MOMMYS_LITTLE = "girl"
# $Env:CARGO_MOMMYS_PRONOUNS = "her"
# $Env:CARGO_MOMMYS_ROLES = "mommy"
# $Env:CARGO_MOMMYS_EMOTES = "❀️ /πŸ’–/πŸ’—/πŸ’“/πŸ’ž"
# $Env:CARGO_MOMMYS_MOODS = "chill/ominous"
# Hijack cargo-mommy for arbitrary commands
function mommy {
param (
[Parameter(Mandatory, ValueFromRemainingArguments, Position=0)]
[string[]]$args
)
$Env:CARGO_MOMMYS_ACTUAL = $args[0]
$args = $args[1..$args.Length]
cargo-mommy @args
}
# Aliases from clang-mommy
function gcc { param ([Parameter(Mandatory, ValueFromRemainingArguments, Position=0)] [string[]]$args) mommy gcc @args }
function g++ { param ([Parameter(Mandatory, ValueFromRemainingArguments, Position=0)] [string[]]$args) mommy g++ @args }
function clang { param ([Parameter(Mandatory, ValueFromRemainingArguments, Position=0)] [string[]]$args) mommy clang @args }
function dotnet { param ([Parameter(Mandatory, ValueFromRemainingArguments, Position=0)] [string[]]$args) mommy dotnet @args }
function Ensure-CargoMommy {
if (!(Get-Command "cargo-mommy" -ErrorAction SilentlyContinue)) {
Invoke-RestMethod "https://github.com/Gankra/cargo-mommy/releases/download/v0.3.1/cargo-mommy-installer.ps1" | Invoke-Expression
}
}
function Update-Profile {
$content = Invoke-RestMethod "https://gist.github.com/oskardotglobal/e1966ec6062724548b4d57a244cbb26f/raw/6d84cfe163ff5496d2f2f0c0afc3b6df537e834a/clang-mommy-profile.ps1"
if (!(Test-Path -Path $profile)) {
New-Item -ItemType File -Path $profile -Force
}
Add-Content -Path $profile -Value $content
}
Ensure-CargoMommy
Update-Profile
Write-Host "Installation complete. Edit $profile for further customization."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment