Coder Social home page Coder Social logo

chips's Introduction

A plugin manager for fish.

Features

  • (supposed to be) Fast. Compiled to the native machine code. Parallel installation/upgrade of plugins.
  • Minimally invasive to your config.fish: Adding one line is sufficient.
  • Minimum overhead to the fish shell itself. The amount of fish script to be loaded for chips to work is extremely little.
  • Minimum installation cost: No dependency except git and curl. chips is a single statically-compiled binary executable file.
  • Uninstallation is easy: Remove chips, ~/.config/chips, and the line in config.fish, and you're clean as if you never installed chips at all.

Installation

Current version: chips 1.1.2 (2017-01-16)

GNU/Linux (x64)

Assuming ~/.local/bin is in your $PATH:

curl -Lo ~/.local/bin/chips --create-dirs \
    https://github.com/xtendo-org/chips/releases/download/1.1.2/chips_gnulinux \
    ; and chmod +x ~/.local/bin/chips

OS X (or macOS)

Assuming ~/.local/bin is in your $PATH:

curl -Lo ~/.local/bin/chips --create-dirs \
    https://github.com/xtendo-org/chips/releases/download/1.1.2/chips_osx \
    ; and chmod +x ~/.local/bin/chips

Installation the hard way: Build from source

Use Stack.

git clone --depth=1 https://github.com/xtendo-org/chips
cd chips
stack install

Usage

  1. Run chips. This will create ~/.config/chips/plugin.yaml with the default template.
  2. Edit plugin.yaml to include your desired plugins. For example, consider fish-sensible or shellder.
  3. Run chips; exec fish.

After this, any time you make changes to plugin.yaml or want to update plugins, run chips again.

Supported features

  • Sourcing init.fish of plugins
  • Installing themes: Plugins that contain fish_prompt.fish or fish_right_prompt.fish
  • functions provided by plugins

To do

  • Completely purging unused plugins
  • Files under completions

Officially recommended plugins

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

FAQ

Why not fisherman?

chips is not written by someone who abuses DMCA takedown to bully other free software projects. In fact, OMF getting shot down was the first motivation to write chips.

chips's People

Contributors

xtendo-org avatar simnalamburt avatar kinoru avatar heejongahn avatar

Stargazers

Zephyr Lykos avatar Anthony Ascencio avatar Gianni Hong avatar Carlos Amorim avatar Tim Kersey avatar Michel Rogers-Vallée avatar  avatar Chansu Park avatar Jesse Claven avatar Jeongjoon Lee avatar Alejandro Lazaro avatar Montana Flynn avatar ebaker avatar Mustaqim Malim avatar Oscar Forner Martinez avatar Jkyo Chen avatar Mu hun avatar Bang Yongbae (Brice) avatar Denis Stoyanov avatar Rafael Bodill avatar Bazyli Brzóska avatar MAISIE(Kim Yangseon) avatar  avatar Josias Iquabius avatar Patrick C. avatar  avatar Pau Ruiz Safont avatar Wojtek T avatar yāλu avatar Sean Hagstrom avatar Andrew Prentice avatar Alexey Makarov avatar Park Hee Chan avatar Koray AL avatar Dave Wongillies avatar tmaone avatar eg avatar Matthew Boehlig avatar Minwoo Kim avatar Yoonmi Roh avatar Yusuke Abe avatar Matthías Páll Gissurarson avatar Matthew Newton avatar Steven Hum avatar LEE Jaeyoung avatar Raphael Ribeiro avatar Chris Olstrom avatar Alexey Alekhin avatar Sooheon Kim avatar Bruno Pinto avatar Nikolay Kolev avatar Tatsuya Hirose avatar Albert avatar  avatar Lee Wonjoon avatar Jordan Arentsen avatar sungjin.kang avatar Alan Kash avatar Seokju Yun avatar 즈눅 avatar Paul Young avatar JongChan Choi (Rieul) avatar Sindre Føring Devik avatar Dmitrii Dolgov avatar Fernando Freire avatar Yun-Yan Chi avatar Jaeho Lee (Jay) avatar Brian Jones avatar Damián Franco Álvarez avatar Michael Carpenter avatar Ben Spaulding avatar  avatar  avatar

Watchers

Mark Derricutt avatar Steven Hum avatar  avatar 즈눅 avatar Patrick C. avatar

chips's Issues

Chips cannot auto-upgrade inself

How to reproduce this error

image

In some reason, uploaded chips 1.1.0 says that its version is 1.0.0. This might be a clue to fix this bug.

chips: fish plugin manager
version 1.0.0

Related issue

Config with nix?

It'd be cool if there were a chips config that uses Nix, like this nix config for oh-my-zsh. That way, nix users could just write a line in their nix config, (as in this oh-my-zsh nix config), and that would automatically configure everything with the right plugins.

Since no other fish plugin managers are built into Nix yet, this would give Chips an edge over the others.

Release the next version of chips

The next chips release will be HUGE, because it'll shipped with the PR #25 being merged. Which means, the next release of chips will support Ubuntu 14.04 LTS.

I have serious problem building chips in my own hand because of commercialhaskell/stack#2780. Someone please upload the latest pre-built chips binary in this issue. Thanks!

Please specity your target triple when you upload your own binary. Example:

  1. i686-windows-gnu
  2. x86_64-unknown-linux-gnu
  3. aarch64-unknown-linux-musl
  4. x86_64-apple-darwin, OS X 10.12

You should specify distribution version if you're uploading darwin binary.

Check the availability of git and curl

chips depends on the commands git and curl. Therefore, it should first check for their existence, and print an error message if they're not available.

Both are not part of the POSIX standard. Although curl is included in nearly all GNU/Linux distros and OS X, git obviously isn't. I've never seen a user desktop operating system which ships with it by default.

Doesn't work on Sierra

I get the following error when trying to run chips on the macOS Sierra public beta:

fish: 'chips' terminated by signal SIGKILL (Forced quit)

Doesn't work on WSL

Windows Subsystem for Linux should be compatible with unmodified Linux executables, but Chips doesn't work:

Failed to execute process '/home/sargun/.local/bin/chips'. Reason:
exec: Exec format error
The file '/home/sargun/.local/bin/chips' is marked as an executable but could not be run by the operating system.

Additionally, install from source doesn't work due to this WSL bug: microsoft/WSL#307

Do not self-update if release version is lower

Normally this is impossible; the release version would always be higher than the local version. But during the development, this could quite often be true.

This is issue is a version blocker. We can't release the next version without resolving this, because we won't be able to roll out RCs (or anything that's not the next stable version, for that matter).

Perhaps we should use semver.

[RFC] Inject alias for chips at config.fish

Current implementation just injects the line to the config.fish below:

# chips (don't touch the line below!)
if [ -e ~/.config/chips/build.fish ] ; source ~/.config/chips/build.fish ; end

And current implementation seems to be assuming that chips executable file is located at ~/.local/bin/chips

-- https://github.com/kinoru/chips/blob/master/src/Lib.hs#L57
execPath <- (byteString <$> getExecutablePath) >>= \ p ->
    if "/ghc" `B.isSuffixOf` p
    then (<> "/.local/bin/chips") . byteString <$> getHomeDirectory
    else return p

Then why don't we add the alias for chips at the config.fish? It will provide better default and better UX to the users.

# chips (don't touch the lines below!)
alias chips "~/.local/bin/chips; and exec fish"
if [ -e ~/.config/chips/build.fish ]; source ~/.config/chips/build.fish; end

Running chips should reload the configuration

Currently running chips is not sufficient to update the plugin system; it doesn't load the new plugins to the current fish shell which ran chips. The shell will remain unchanged.

Let's say the desired use-case scenario is that the user types chips, then the install/update takes place, and the current shell is loaded with the latest configuration and plugins. This means:

  • The executable file needs to call the exec* family of functions to replace itself with fish.
  • Fish needs to execute chips by exec chips, not just chips.

So, we need to add, at the end of the chips source code, a line that calls exec*. Then, in the build.fish file, something like below:

alias chips "exec ~/.local/bin/chips"

Alternatively, we can simply drop the line below in build.fish:

alias chips "~/.local/bin/chips; exec fish"

Running chips without making 'functions' directory throws an exception

If I run chips without making ~/.config/fish/functions directory, it throws an exception.

$ ./chips

chips: fish plugin manager
version 1.0.0
Build result saved at /home/simnalamburt/.config/chips/build.fish
chips: /home/iioopp90/.config/fish/functions: copyFile: does not exist (No such file or directory)

Similar issue with #11

Enable CI for automatic binary building

One of the killer features of chips is that you can use chips with just one binary, without any runtime or dependencies. So let's make an automated build system with CI services and give users a link for chips!

  • Travis CI for Linux and OS X binaries
  • AppVeyor for Windows binary
  • GitHub Actions for Linux, macOS, Windows

chips self-update fail: failed parsing the GitHub releases page. Perhaps you need to manually upgrade.

Related:

chips/src/SelfUpdate.hs

Lines 53 to 58 in 5484641

locationHeader =
"\nLocation: https://github.com/" <> repo <> "/releases/tag/"
getLatest = readProcess "curl"
[ "-D", "-", "-o", "/dev/null"
, "https://github.com/" <> repo <> "/releases/latest"
]

First, yes I still use chips, and second, HTTP header name is case-insensitive. Don't know why but after HTTP/2, many web pages started to just use lowercase for all HTTP header names, including GitHub:

$ curl -I https://github.com/xtendo-org/chips/releases/latest
HTTP/2 302
server: GitHub.com
date: Fri, 31 Mar 2023 10:59:48 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With
location: https://github.com/xtendo-org/chips/releases/tag/1.1.2
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
(...)

Haskell's best networking library, readProcess "curl", has -w/--write-out <format> option to give some variables:

curl -w '%{redirect_url}' https://github.com/xtendo-org/chips/releases/latest

Or, if you prefer another way:

curl -w '%header{location}' https://github.com/xtendo-org/chips/releases/latest

bug: Chips deletes all the plugins when executed offline

When a user tries to update/install plugins without internet connection, something like this happens:

chips: fish plugin manager
version 1.0.0
Checking update for theme-bobthefish...
Checking update for fish-sensible...
Failed checking update for fish-sensible.
Failed checking update for theme-bobthefish.
Build result saved at /Users/nobell/.config/chips/build.fish

As (failed) build result is saved at build.fish, it deletes (some of) existing plugins. For this case, theme-bobthefish survived but fish-sensible didn't. Maybe just popping out the error message and doing nothing (or just prune unused plugins) when offline would do the trick?

Running chips without making `config.fish` throws an exception

If I run chips without making ~/.config/fish/config.fish, it throws an exception.

$ ./chips

chips: fish plugin manager
version 1.0.0
Build result saved at /home/simnalamburt/.config/chips/build.fish
chips: /home/simnalamburt/.config/fish/config.fish: openBinaryFile: does not exist (No such file or directory)

Proposal

if config.fish doesn't exist, I think making new config.fish and injecting chips codes would be an agreeable default behavior. How do you think?

Let's support more platforms

Chips is awesome! I want to spread this program to various platforms.

For POSIX platforms

#!/bin/bash
# Requirements: libgmp git stack strip upx zip
export TARGET="x86_64-linux" && \
  git clone https://github.com/xtendo-org/chips.git --depth=1 --branch=1.1.2 && \
  cd chips && \
  stack setup && \
  stack build && \
  cp .stack-work/install/"$TARGET"/nightly-2016-10-29/8.0.1/bin/chips chips-"$TARGET" && \
  strip --strip-all --remove-section=.comment --remove-section=.note chips-"$TARGET" && \
  upx -9 --lzma chips-"$TARGET" && \
  zip chips-"$TARGET".zip chips-"$TARGET" && \
  rm chips-"$TARGET"

For macOS

#!/bin/bash
# Requirements: libgmp git stack strip upx zip
export TARGET="x86_64-osx" && \
  git clone https://github.com/xtendo-org/chips.git --depth=1 --branch=1.1.2 && \
  cd chips && \
  stack setup && \
  stack build && \
  cp .stack-work/install/"$TARGET"/nightly-2016-10-29/8.0.1/bin/chips chips-"$TARGET" && \
  strip -u -r chips-"$TARGET" && \
  upx -9 --lzma chips-"$TARGET" && \
  zip chips-"$TARGET".zip chips-"$TARGET" && \
  rm chips-"$TARGET"

TODOs

chips shell autocompletion

Would this lib be useful in getting autocompletion of commands?

The example for this being typing chips and then hitting [TAB] would then give a prompt out to the shell for the commands available. This would in theory also allow if you type chips l to autocomplete to chips list or to give the possible commands from the query.

https://github.com/mbrubeck/compleat

Just found this project and looks awesome. Great that this is a binary distribution.

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.