Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Funky takes shell functions to the next level by making them easier to define, more flexible, and more interactive.

License

NotificationsYou must be signed in to change notification settings

bbugyi200/funky

Repository files navigation

Funky takes shell functions to the next level by making them easier to define, more flexible, and more interactive.

Project VersionPython VersionsPackage Health

Linter: pylintLinter: flake8Types: mypyDocstrings: pydocstyleCode Style: blackImports: isort

Test WorkflowLint WorkflowPublish WorkflowCoverage

demo

Table of Contents

Installation

Usingpipx to Install (preferred)

This packagecould be installed using pip like any other Python package (infact, see the section below this one for instructions). Given that we only needthis package's entry points (e.g. thefunky command), however, we recommendthatpipx be used instead (replaceSHELL with eitherbash orzsh):

# install and setup pipxpython3 -m pip install --user pipxpython3 -m pipx ensurepath# install and setup funkypipx install pyfunkyfunky --setup-shell SHELL

Usingpip to Install

To install funky usingpip, run the following commands in your terminal(replaceSHELL with eitherbash orzsh):

python3 -m pip install --user pyfunky# install funkyfunky --setup-shell SHELL# hook funky into your shell

If you don't have pip installed, thisPython installation guide can guideyou through the process.

Building from Source

You can either clone the public repository:

git clone git://github.com/bbugyi200/funky

Or download thetarball:

curl  -OL https://github.com/bbugyi200/funky/tarball/master

Once you have a copy of the source, you can install funky by running:

make install

The last thing you need to do is hook funky into your preferred shell, whichcan be accomplished with the following command (replaceSHELL with eitherbash orzsh):

funky --setup-shell SHELL

Usage

Funks are manipulated using thefunky andgfunky commands. These commandshave the same user interface. The difference between the two commands istreated in theLocal vs Global section.

Local vs Global

Local funks are stored using a hidden database file that is located in thesame directory where the funk was created. These can be manipulated using theoptions described in the demo above (runfunky -h to see descriptions ofthese options). Once created, a local funk can be used just like any othercommand or normal funk as long as you are inside of the directory where thelocal funk was originally defined.

Global funks, on the other hand, are stored in your home directory(/home/<user>) and can be used from any directory. Local funks can be usedto override global funk definitions.

Local and global funks can be manipulated (created, removed, edited, renamed,etc.) by using thefunky andgfunky commands, respectively.

Funk Definition Shortcuts

Normally when defining a funk, the provided raw definition (the final contentsof the temp file) is inserted directly into the generated function definition.However, funky does try to make some alterations to the original funkdefinition when doing so is convenient. Thesefunky definition shortcuts canmake defining funks faster:

Specialcd Funks

A funk definition of the form@./relative/path/to/directory will be automatically changed to

cd /absolute/path/to/directory/"$@"||return 1

Simulate Shell Variables

A funk definition of the form"Some string here..." will be automatically changed to

echo"Some string here...""$@"

This allows you to use funks to simulate shell variables viacommand substitution.

The "$@" Special Parameter

This project originally used aliases. The decision to migrate to shell functions was made based onthe fact that shell functions are far more capable than aliases. Moreover, there is very littlebenefit to using aliases over shell functions.

With that said, actual aliases do have one appeal over shell functions. When you use an alias, anyarguments that you pass to it are automatically passed to the command definition (at runtime,aliases are just substituted with their definitions). For the purpose of emulating this behaviorwhen it would typically be desired, a funk defined using asingle-line command definitionthatdoes NOT already contain argument variables (e.g. does not contain$0,$1, ...,$9,$*, or$@) will automatically have the"$@" special parameter appended to itsdefinition. This allows for the same automatic argument handling that you would expect from analias.

See the officialBash docs for more information on Bash's special parameters.

Articles / Blog Posts

With the goal of listing alternative sources of documentation / tutorials, thissection will be used to track any articles or blog posts which mention funky:

Similar Projects

  • desk - A lightweight workspace manager for the shell.
  • smartcd - Alter your bash (or zsh) environment as you cd.
  • direnv - is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.

Contributions

Pull requests are welcome. SeeCONTRIBUTING.md for more information.

About

Funky takes shell functions to the next level by making them easier to define, more flexible, and more interactive.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp