GithubHelp home page GithubHelp logo

jandedobbeleer / aliae Goto Github PK

View Code? Open in Web Editor NEW
67.0 67.0 3.0 1.68 MB

Cross shell and platform alias management

Home Page: https://aliae.dev

License: MIT License

Go 48.35% MDX 21.25% JavaScript 10.19% CSS 10.63% PowerShell 5.43% Shell 3.11% Inno Setup 1.04%
alias aliases bash cli hacktoberfest nushell powershell zsh-plugin

aliae's Introduction

Nice to meet you! πŸ‘‹

  • GitHub Star
  • Microsoft MVP
  • Gitkraken Ambassador
  • Warp Terminal Ambassador

I'm not really great at writing introductions, so I asked ChatGPT to help me out.

Jan De Dobbeleer is the creator and maintainer of the popular command-line tool oh-my-posh, which allows users to easily customize their terminal prompt. With over 10,000 stars on GitHub and a growing community of users, oh-my-posh has quickly become a must-have for developers looking to take their terminal experience to the next level.

Jan is a passionate software engineer with a love for creating clean, intuitive, and user-friendly tools. With a background in computer science and years of experience in the industry, he has a deep understanding of what it takes to build successful and widely-used open-source projects.

In addition to oh-my-posh, Jan is also an active contributor to other open-source projects and a frequent speaker at tech conferences and meetups. He is always looking for new ways to improve and expand upon his work, and is constantly pushing the boundaries of what is possible with terminal customization.

If you're a developer looking to improve your terminal experience, or just want to learn more about oh-my-posh and its creator, be sure to check out Jan's GitHub profile and give his project a star!

Jan De Dobeleer's GitHub stats

aliae's People

Contributors

allcontributors[bot] avatar daviddesloovere avatar dependabot[bot] avatar jandedobbeleer avatar kiliantyler avatar ruintd avatar vedantmgoyal9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aliae's Issues

Alias not getting removed on Win10/pwsh

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

The Alias I set using Aliae isn't getting removed after removing it from the .yaml configuration File.

I tried:
reloading the Powershell Profile

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Auto-converting paths between Windows and Linux

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

It would be nice if you could easily convert paths from Windows to WSL / Git Bash.
My idea for the format would look like this:

env:
  - name: POSH_THEME
    value: C:\Documents\theme.omp.yml
    convertPath: true

Converting backwards is probably not necessary, since this feature would mostly benefit Windows users, who'd probably write their Aliae configs with Windows in mind anyway. Plus, I think it would even be possible to convert backwards very easily.

Windows path can be converted to Linux via /mnt/c (WSL) or /c (Git Bash). You could check for the existence of the directories to detect which to use. Note that the drive letters become lowercase. This also only supports fixed drives, not network shares.

This would also be nice in combination with #31 to automatically converts lists of paths.

Ability to create lists in Env

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

The ability to create lists, similar to Path, easily cross-platform, like this:

env:
  - name: USERNAMES
    value: |
      dylan
      steve
      bob ross
# Windows
$Env:USERNAMES = "dylan;steve;bob ross"
# Linux
$Env:USERNAMES = "dylan:steve:boss ross"

Or, with an optional delimeter parameter:

env:
  - name: USERNAMES
    value: |
      dylan
      steve
      bob ross
    delimeter: ","
$Env:USERNAMES = "dylan,steve,bob ross"

init in pwsh profile throws error

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

Thanks for starting this great project. Couldn't wait and had to try it out already. Being early adopter I ran into this issue.

After adding aliae init pwsh | Invoke-Expression to the powershell profile (as per docs) I get the following error:
Invoke-Expression: Cannot bind argument to parameter 'Command' because it is an empty string.

I also have oh-my-posh init pwsh --config "~/.mytheme.omp.json" | Invoke-Expression in my profile, and that works without a problem πŸ˜‰.

Running aliae init pwsh | Invoke-Expression in terminal (powershell) returns the same error.

Running aliae init pwsh returns (@(& aliae init pwsh --config= --print) -join "``n") | Invoke-Expression. With a single "`", just markdown issues here in GH.

PowerShell 7.3.5

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

provide a `get shell` like oh my posh

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

Since I think I'll be using aliae to bootstrap oh-my-posh it would be nice to have the same get shell capability

So I can change my bootstrap.sh from

if (! command -v aliae &> /dev/null )
then
  mkdir -p $HOME/.local/bin
  curl -s https://aliae.dev/install.sh | bash -s -- -d $HOME/.local/bin
  export PATH=$HOME/.local/bin:$PATH
fi
if [ -e $HOME/OneDrive/gist/aliae.yml ]
then
  ALIAE_CONFIG="$HOME/OneDrive/gist/aliae.yml"
else
  ALIAE_CONFIG="https://gist.githubusercontent.com/trajano/315fecc2986b5ac5f642d207d79303f8/raw/5b6a905fd426c70d84cbba5713978ddd2a9a9b37/aliae.yml"
fi
if [ "$ZSH_VERSION" ]
  then
    eval "$( aliae init zsh -c $ALIAE_CONFIG )"
elif [ "$BASH_VERSION" ]
then
  eval "$( aliae init bash -c $ALIAE_CONFIG )"
elif [ "$FISH_VERSION" ]
then
  aliae init fish -c $ALIAE_CONFIG | source
fi

to

if (! command -v aliae &> /dev/null )
then
  mkdir -p $HOME/.local/bin
  curl -s https://aliae.dev/install.sh | bash -s -- -d $HOME/.local/bin
  export PATH=$HOME/.local/bin:$PATH
fi
if [ -e $HOME/OneDrive/gist/aliae.yml ]
then
  ALIAE_CONFIG="$HOME/OneDrive/gist/aliae.yml"
else
  ALIAE_CONFIG="https://gist.githubusercontent.com/trajano/315fecc2986b5ac5f642d207d79303f8/raw/5b6a905fd426c70d84cbba5713978ddd2a9a9b37/aliae.yml"
fi
if [ "$ZSH_VERSION" || $BASH_VERSION" ]
  then
    eval "$( aliae init $(aliae get shell )-c $ALIAE_CONFIG )"
elif [ "$FISH_VERSION" ]
then
  aliae init fish -c $ALIAE_CONFIG | source 
fi

Though something that would generate the actual command for multiple shells would be better since this can only apply to zsh and bash (which are the two I primarily use)

git alias evaluates at the time of loading profile

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

aliae config

alias:
  - name: db
    value: "!basename $(git symbolic-ref refs/remotes/origin/HEAD)"
    type: git

after reloading profile git config looks like this

[alias]
db = "!basename "

or like this if reloaded in context of git repository

[alias]
db = !basename refs/remotes/origin/master

expected to see this

[alias]
db = !basename $(git symbolic-ref refs/remotes/origin/HEAD)

What OS are you seeing the problem on?

Windows, Linux

Which shell are you using?

bash, powershell

Git repo is checked before when git aliases are used

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

Seems like it is checking for a git repo when git aliases are used.

+++++ git rev-parse --abbrev-ref HEAD
fatal: not a git repository (or any of the parent directories): .git

What OS are you seeing the problem on?

Linux

Which shell are you using?

bash

`.` should be treated as a function

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

I have the followubg config

---
alias:
  - name: .
    value: eval "$(aliae init bash)"

in bash it generates

alias .="eval \"$(aliae init bash)\""

but when I run . I get

`alias .': invalid alias name

What should happen is it should generate

.() {
  eval "$(aliae init bash)"
}

What OS are you seeing the problem on?

No response

Which shell are you using?

No response

init fails when ALIAE_CONFIG points to url

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

#51 addded support for setting config via environment variable, but it works only for local files. When variable points to remote file initialization fails

my pwsh profile looks like this

$env:ALIAE_CONFIG = "https://...";
aliae init pwsh | Invoke-Expression

pwsh error

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x6d1b09]

goroutine 1 [running]:
github.com/jandedobbeleer/aliae/src/config.LoadConfig({0xc00011c0b2?, 0x4?})
        /home/runner/work/aliae/aliae/src/config/config.go:54 +0xe9
github.com/jandedobbeleer/aliae/src/core.Init({0xc00011c0b2, 0x0}, {0xc00011c090, 0x4}, 0x1)
        /home/runner/work/aliae/aliae/src/core/init.go:18 +0x9e
github.com/jandedobbeleer/aliae/src/cli.runInit({0xc00011c090?, 0x0?})
        /home/runner/work/aliae/aliae/src/cli/init.go:48 +0x39
github.com/jandedobbeleer/aliae/src/cli.glob..func2(0xc00016e100?, {0xc0001090b0?, 0x4?, 0x781f08?})
        /home/runner/work/aliae/aliae/src/cli/init.go:36 +0x2f
github.com/spf13/cobra.(*Command).execute(0xac6e60, {0xc000109050, 0x3, 0x3})
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xaa3
github.com/spf13/cobra.(*Command).ExecuteC(0xac7140)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/jandedobbeleer/aliae/src/cli.Execute({0x830ca0?, 0xc000088000?})
        /home/runner/work/aliae/aliae/src/cli/root.go:36 +0x49
main.main()
        /home/runner/work/aliae/aliae/src/main.go:10 +0x25
Invoke-Expression: Cannot bind argument to parameter 'Command' because it is an empty string.

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

CDPATH support

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

we already have paths for PATH but I was wondering if we can have it for other PATH like structures like CDPATH (though that's basically the only other example I know and it's limited to BASH and ZSH maybe FISH)

What I do for now

  - value: |
      setopt auto_cd
      cdpath=($HOME $HOME/p)
    if: and (eq .Shell "zsh") (eq .OS "darwin")

Path doesn't work on PowerShell on Linux

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

Path doesn't work on PowerShell on Linux because of two issues:

  1. It writes to Path. Linux's envs are case-sensitive, and it should be PATH.
  2. Aliae adds ; (Windows) delimiters between values, instead of : (Linux), even on Linux.

What OS are you seeing the problem on?

Linux

Which shell are you using?

powershell

Invalid argument starting on powershell

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

I tried starting this application on "powershell", but this message appears:

Command: aliae init powershell | Invoke-Expression

Message:

Error: invalid argument "powershell" for "aliae init"
Usage:
  aliae init [bash|zsh|fish|powershell|pwsh|cmd|nu|tcsh|xonsh] --config ~/.aliae.yaml [flags]

Flags:
  -h, --help    help for init
  -p, --print   print the init script

Global Flags:
  -c, --config string   config file path

Looks like "powershell" is a invalid argument, but the help message lists it like was valid!

Thanks.

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Empty response for powershell env vars

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

in env block adding global env vars resulting in empty response.

env:
  - name: USER_NAME
    value: $ENV:USERNAME
    if: match .Shell "pwsh"

This works

but

env:
  - name: ALIAE_CONFIG
    value: C:\Users\$($ENV:USERNAME)\.aliae.yaml
    if: match .Shell "pwsh"

this resulting in C:\\Users\\\\.aliae.yaml

is this even supported?

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Make PowerShell-specific configuration keys for aliases available for variable definitions as well

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

This is quite the nifty little tool you've whipped up here! As someone who has to utilize a mixture of Windows and Linux setups and is often forced to shift between them unexpectedly and more than I'd like to, I see a lot of potential here to be able to make changes to all of my dev. environments in just one place and propagate through all of them from there with much more reliability, which is exciting.

My inquiry/request is exactly as seen in the title, namely if you think it's possible to make the exact same PowerShell-specific subkeys currently evaluated for alias:β€”description:, force:, option: and scope:β€”likewise be parsed for variables set using env: in an aliae configuration file? I make pretty extensive use of those arguments with both Set-Variable as well as Set-Alias in my PowerShell profiles currently to keep certain workflows behaving appropriately for each of the user accounts I may identify to them as.

My hope is that the nature of PowerShell arguments to be interpreted according to a fairly strict rubric (provided the Commands they modify share the same Verb prefix, as Set-Alias and Set-Variable do) will mean this is a fairly trivial and uncontentious request. Of course I'd normally prefer to present a need such as this in the form of a PR, but having zero prior experience coding in Go made me hesitate to do so. Rather than try and "wing it" and possibly cause you to spend more time bringing me up to speed while reviewing such a PR, it seemed best to first make contact and gauge your amenability to the idea, first. (As an aside, your issue template configuration currently has a button whose target is the Discussions area and I had first tried to go down that path, but it was a dead end, as this repo's Discussions feature isn't actually turned on, hehe.)

I look forward to hearing your thoughts, and of course stand ready to pitch in by submitting updates to the documentation that reflect any new behavior stemming from my request. Thank you for your time and consideration.

Warmly,
Peter

Existence check of command or file

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

{{ .CommandAvailable "some-command" }}

But this is a bit complicated because on bash it should be doing something like command -v "$1" > /dev/null

{{ .FileExists "{{.Home}}/my-stuff" }}

Would be a simple [ -e $1 ]

script installs incompatible version on WSL

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

when installing withcurl -s https://aliae.dev/install.sh | bash -s on wsl, bash responds with
/home/<user>/bin/aliae: line 1: Not: command not found

tool works when building from source

What OS are you seeing the problem on?

Linux

Which shell are you using?

bash

Windows: Auto exporting env variables

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

It would be nice if, on Windows, I could automatically export environment variables to the user env variables to be used outside of CLI, and to be managed within Aliae's config file along with my other env variables.

In combination with #31, this would allow me to do something like this:

env:
  - name: PRISMLAUNCHER_JAVA_PATHS
    value: |
      {{ .Home }}\scoop\apps\temurin8-jre\current\bin\javaw.exe
      {{ .Home }}\scoop\apps\temurin-lts-jre\current\bin\javaw.exe
    export: true

So that Prism Launcher can find my Java installs and I don't have to go crazy using Microsoft's env editor.

It's worth noting that this would only be user env variables, since system env variables would require an admin prompt every time you open a shell.

Specify config path in Env

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

It would be nice if, similar to POSH_THEME in OMP, I could provide the path to my Aliae config in an environment variable like ALIAE_CONFIG, so I could just aliae init pwsh instead of aliae init pwsh --config $Env:ALIAE_CONFIG (or similar) for each Shell.

path should have an option to check for existence before adding.

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

Something new and amazing!

path:
  - value: |
      {{ .Home }}/.local/bin
    ifExists: true # defaults to false

This will check that the directory is present before changing path. It should be false by default to keep it speedy and in case the path is in a network drive which means it will slow startup if existence is checked.

Existance check of a file

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

Something like

ssh-agent: 
  enabled: true

which maps to something along the lines of

script:
  - value: |
      eval $( ssh-agent )
  - if: 
      - ssh-agent executable is available
      - SSH_AUTH_SOCK env var is not set

Other options

ssh-agent: 
  force: true # ignore existing env var
  executables:  # override executable
    - executable: /opt/my/ssh-agent
       if: 
         - os == darwin etc.
    - executable: ssh-agent # default since it has no `if` may be omitted

Provide `uname -m` to provide the system architecture

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

{{ .Arch }}

Machine architecture so we can have

  - value: |
      if (! command -v bat &> /dev/null )
      then
        curl -sL https://github.com/sharkdp/bat/releases/download/v0.24.0/bat-v0.24.0-{{ some value based on .Arch }}.tar.gz | tar zxf - -C "{{ .Home }}/.local/bin" --strip-components=1 --wildcards bat-v0.24.0-i686-unknown-linux-musl/bat
      fi
    if: and (match .Shell "bash" "zsh") (eq .OS "Linux")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.