Bash : Replace aliases.

This commit is contained in:
Dmitry Voronin 2024-10-04 12:08:23 +03:00
parent 396fff0367
commit 6324a2a46c
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 7 additions and 10 deletions

View file

@ -1,11 +1,10 @@
{ ... }: { { ... }: {
text = '' text = ''
# Open file/dir in GUI. # Open file/dir in GUI.
# Usage: open <FILE> # Usage: o <FILE>
function open() { function o() {
xdg-open "''${@}" xdg-open "''${@}"
} }
alias o="open"
# Play media file from CLI. All files by default. # Play media file from CLI. All files by default.
# Usage: play [FILE] # Usage: play [FILE]

View file

@ -24,8 +24,8 @@
# Spawn shell with specified nix environment. # Spawn shell with specified nix environment.
# Uses flake.nix in current dir by default. # Uses flake.nix in current dir by default.
# Usage: nix_shell [NAME] # Usage: shell [NAME]
function nix_shell() { function shell() {
local target="''${1}" local target="''${1}"
[[ "''${target}" = "" ]] && target="default" [[ "''${target}" = "" ]] && target="default"
@ -34,18 +34,17 @@
SHELL_NAME="''${target}" nix develop ".#devShells.''${NIX_CURRENT_SYSTEM}.''${target}" SHELL_NAME="''${target}" nix develop ".#devShells.''${NIX_CURRENT_SYSTEM}.''${target}"
} }
alias shell="nix_shell"
# Spawn temporary nix-shell with specified packages. # Spawn temporary nix-shell with specified packages.
# Usage: nix_tmpshell <PACKAGES> # Usage: tmpshell <PACKAGES>
function nix_tmpshell() { function tmpshell() {
local IFS=$'\n' local IFS=$'\n'
local input=("''${@}") local input=("''${@}")
local pkgs=() local pkgs=()
local tag="''${SHELL_NAME}" local tag="''${SHELL_NAME}"
if [[ "''${input}" = "" ]]; then if [[ "''${input}" = "" ]]; then
help nix_tmpshell help tmpshell
return 2 return 2
fi fi
@ -57,7 +56,6 @@
SHELL_NAME="''${tag}" NIXPKGS_ALLOW_UNFREE=1 nix shell --impure ''${pkgs[@]} SHELL_NAME="''${tag}" NIXPKGS_ALLOW_UNFREE=1 nix shell --impure ''${pkgs[@]}
} }
alias tmpshell="nix_tmpshell"
# Build live image. # Build live image.
function nixos_live() { function nixos_live() {