antibody

package module
Version: v2.0.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2016 License: MIT Imports: 5 Imported by: 0

README

A shell plugin manager written in Golang.

License Build Status Coverage Status Go Report Card

Antibody can manage plugins for shells (zsh, for example), both loading them with source or export-ing them to PATH, for example.

Why?

I was using Antigen before. It is a good plugin manager, but at the same time it's bloated and slow - 5+ seconds to load on my Mac... that's way too much to wait for a prompt to load!

Antigen is focused in performance, and, since v2.0.0, manage more than just ZSH plugins, but also PATH plugins (those project with binaries) and it is easy enough to implement it for Fish and others.

asciicast

I'm aware that there are other attempts, like antigen-hs, but I don't want to install a lot of stuff for this to work.

Why Go

Well, the compiled Go program runs anywhere and doesn't depend on any shared libraries. I also don't need to source it as it would be necessary with plain simple shell. I also can do stuff in parallel with Go routines.

What works

These are the only antigen commands I ever used:

  • bundle
  • update
  • apply

Antibody does just those three things, but you don't even need to apply. Running antibody bundle will already download and apply the given bundle.

antibody home also shows where the repositories are being downloaded.

What doesn't work

  • The theme command (although most themes might just work with bundle);
  • oh-my-zsh support: it looks very ugly to me and I won't do it;

Install

The simplest way to install Antibody is to run:

$ curl -s https://raw.githubusercontent.com/getantibody/installer/master/install | bash -s
$ echo 'source <(antibody init)' >> ~/.zshrc

This will put the binary in /usr/local/bin/antibody and setup your ~/.zshrc to load what is needed on startup.

Usage

Now, you can just antibody bundle stuff, e.g., antibody bundle caarlos0/jvm. The repository will be cloned at your OS cache folder (check antibody home) folder.

The ZSH bundle implementation will try to load files that match:

  • *.plugin.zsh
  • *.zsh
  • *.sh
  • *.zsh-theme

The Path bundle implementation will just add the folder to your PATH.

You can change the impl by adding kind:zsh or kind:path to the argument, as in antibody bundle 'caarlos0/ports kind:path'

You can also specify a branch to download, for example, antibody bundle caarlos0/jvm branch:v2 will download the v2 branch of that repository.

When you decide to update your bundles, just run antibody update: it will update all bundles inside the antibody home folder.

Protips

Prefer to use it like this:

$ cat plugins.txt
caarlos0/jvm
caarlos0/ports kind:path
djui/alias-tips
caarlos0/zsh-mkc
zsh-users/zsh-completions
caarlos0/zsh-open-github-pr
zsh-users/zsh-syntax-highlighting
zsh-users/zsh-history-substring-search

$ antibody bundle < plugins.txt

This way antibody can concurrently clone the bundles and find return the shell line, so it will probably be faster than call each one separately.

In the wild

Static loading

You can use antibody in a static-loading manner (so you don't need to exec antibody every time you open a shell).

$ antibody bundle < bundles.txt >> sourceables.sh
# In your zshrc (or whatever):
$ source sourceables.sh

Beware that antibody does stuff in parallel, so bundle order is not guaranteed.

PS: since v2.0.0, this is the default behavior.

Thanks

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Home

func Home() string

Home finds the right home folder to use

Types

type Antibody

type Antibody struct {
	Events chan event.Event
	Lines  []string
	Home   string
}

Antibody the main thing

func New added in v0.3.1

func New(home string, lines []string) *Antibody

New creates a new Antibody instance with the given parameters

func (*Antibody) Bundle

func (a *Antibody) Bundle() (string, error)

Bundle processes all given lines and returns the shell content to execute

Source Files

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL