Giter VIP home page Giter VIP logo

elvish-modules's Introduction

zzamboni’s Elvish libraries

This Elvish package contains various modules I have written for the Elvish shell. Themes and completions are kept in separate packages.

Compatibility

These modules are only guaranteed to be fully compatible with Elvish HEAD, which is what I use. This means that occasionally, they will not work even with the latest official release, when breaking changes are introduced. Since Elvish is in active development, I highly recommend you use the latest commit too.

Installation

To install, use epm:

use epm
epm:install github.com/zzamboni/elvish-modules

For each module you want to use, you need to add the following to your rc.elv file:

use github.com/zzamboni/elvish-modules/<modulename>

See each module’s page for detailed usage instructions.

Modules

The following modules are included:

1pass

This module provides wrappers to use the 1Password op CLI tool with Elvish.

alias

Implementation of aliases for Elvish.

atlas

Elvish functions for interacting with O’Reilly’s Atlas publishing system.

bang-bang

Implement the !! (last command), !$ (last argument of last command), !* (all arguments) and !<n> (nth argument of last command) shortcuts in Elvish.

dir

Keep and move through the directory history, including a graphical chooser, similar to Elvish’s Location mode, but showing a chronological directory history instead of a weighted one.

git-summary

Display a status summary of a user-defined list of git repositories.

git-vcsh

Simple wrapper to call vcsh when the current directory is managed by it. I don’t use it anymore, so it may be broken.

iterm2

This library implements iTerm2’s Shell Integration for the Elvish shell.

lazy-vars

A module that allows defining environment variables that are only evaluated when needed.

leanpub

This module provides some interfaces to the LeanPub API.

long-running-notifications

Produce notifications for long-running commands in Elvish.

nix

Functions to set up the Nix environment variables for Elvish.

opsgenie

This module implements a few common operations for the OpsGenie API in Elvish.

prompt-hooks

Convenience functions to add hooks to the prompt hook lists.

proxy

Manipulation of proxy-related environment variables (including auto-setting/unsetting based on a user-defined test) for Elvish.

semver

Comparison of semantic version numbers, as described in the Semantic Versioning specification.

spinners

Functions to print different types of progress spinners for use in Elvish scripts.

terminal-title

Sets the terminal title dynamically using ANSI escape codes. By default the current directory is shown, and the name of the current command while one is executing.

test

A very simplistic test framework for Elvish.

tinytex

Convenience functions for TinyTeX.

tty

Functions for terminal ANSI code manipulation/interaction in Elvish.

util

Various utility functions.

elvish-modules's People

Contributors

krader1961 avatar sitischu avatar solitudesf avatar star-szr avatar xiaq avatar zzamboni 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

elvish-modules's Issues

semver module: missing MINOR, PATCH should not be ignored

(Reported by @krader1961)

According to the documentation:

A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers

Currently semver considers missing Y or Z as zeros, so that:

> semver:eq 1.0 1.0.0
▶ $true

This should produce an error - maybe there should be a &non-strict option to allow parsing non-strictly-compliant numbers.

long-running-notifications should use the `edit:after-command` hook

This question was posed by @dcuadrado on IM an hour ago:

in the notifier is there a way to know if the process failed? I'd like it to say something out loud if the command failed

The answer is, no, given the current implementation. However, if the implementation were changed to use the edit:after-command hook introduced by commit elves/elvish@e2f8100 it could both report sub-second durations and the status of the command; i.e., whether or not it failed and if it failed how it failed.

Aliases Broken

Not sure which commit, but something in the last day seems to have broken aliases. As far as I can tell aliases are simply not being found and launched. The best example is probably just ls:

alias:def ls e:ls -G

If you type 'ls' it should return with colors (on macOS at least), but instead it's just a plain boring white ls output.

error loading modules

Hello, I just discovered elvish, and I am loving it.
I can use:
use github.com/iwoloschin/elvish-packages/update
use epm
epm:install &silent-if-installed ^
github.com/zzamboni/elvish-modules ^
github.com/zzamboni/elvish-completions ^
github.com/zzamboni/elvish-themes ^
github.com/xiaq/edit.elv ^
github.com/muesli/elvish-libs ^

without issues

But, I am trying to use bang-bang or aliases and is failing
use github.com/zzamboni/elvish-completions/alias
Exception: no such module: github.com/zzamboni/elvish-completions/alias
[tty 46], line 1: use github.com/zzamboni/elvish-completions/alias

Any idea of what am I doing wrong?

Thanks

Should aliases be persistent?

The alias module at the moment automatically saves aliases defined with alias:new to individual files under ~/.elvish/aliases/. This is nice for interactive use, but I am not convinced of this being a good thing. For the most part, aliases should be defined in the config file, and I think it is a good thing that, if they need to be persistent, they should be defined there so that the config file is a "single source of truth". Maybe a new alias:save function could be added for when you want to save certain aliases, but not be the default behavior.

util:getfile no longer works correctly

At some point, Apple in their infinite wisdom has changed the escape conventions for filenames dragged from the Finder into the terminal, so the current code no longer works.

This seems to be the new convention:

  • If the dragged pathname is free of special characters, it is input as is. So far so good.
  • If there are special characters, the pathname is quoted using single quotes. If so,
    • single quotes in the path name are escaped with a preceding backslash,
    • and so is any backslash.

Example: A file named a'b\c gets entered as '…/a\'b\\c', where is the directory part.

I don't know of any shell that obeys these escape conventions – certainly not bash or zsh – so I don't know what Apple has been thinking. And since these seem so awfully wrong, I suspect it may get changed yet again. If not, the new convention is easy enough to parse, but I don't have a moment to spare for this in the foreseeable future.

dir.org README should contain better instructions for using the alias package

  1. The hyperlink to the alias.org README renders as code rather than a clickable link.
  2. I haven't looked at zzamboni/elvish-modules packages other than alias, bang-bang, and dir, so I don't know if any others refer to using alias, but if they do, they as well as this one should mention, as reported in #5 , that the -exports- = (alias:export) needs to appear in the rc.elv file and come after all uses of the alias command.

Useless use of `cat`

FYI, while responding to elves/elvish#1416 I noticed that alias.org has two lines of this form:

var content = (cat $file | slurp)

There isn't any need for cat and a pipeline, just do var content = (slurp < $file). I know your alias module is probably no longer being actively maintained now that Elvish has edit:add-var but you should still probably review all your Elvish code for useless uses of cat. 😺

dir module not working on elvish 0.15?

Absolute beginner in Elvish, sorry if this is something silly, but I just tried this:

#! /usr/bin/env nix-shell
#! nix-shell -i elvish -p elvish

use epm
epm:install github.com/zzamboni/elvish-modules

use github.com/zzamboni/elvish-modules/dir

use github.com/zzamboni/elvish-modules/alias
alias:new cd "use github.com/zzamboni/elvish-modules/dir; dir:cd"

cd bastion
cd -

And got:

Exception: compilation error: variable $edit:current-command not found
/Users/juliano/.elvish/lib/github.com/zzamboni/elvish-modules/dir.elv, line 89:   if (> (count $edit:current-command) 0) {
/Users/juliano/git/NoRedInk/tf-all.elv, line 7: use github.com/zzamboni/elvish-modules/dir

long-running-notifications: Allow specifying commands to ignore

For interactive applications like editors (vim, nano), pagers (less), shells (elvish, bash) and others getting a notification of the time the command ran isn't really useful.

It would be nice if it was possible to pass a list of command names to ignore to long-running-notifications

semver module: build metadata should be ignored

(Reported by @krader1961)

According to the documentation:

Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3—-117B344092BD.

Currently the metadata is considered as part of the build string, so it's used in the comparison:

semver:eq 1.0.0-alpha+001 1.0.0+20130313144700 1.0.0-beta+exp.sha.5114f85 1.0.0+21AF26D3—-117B344092BD
▶ $false

[dir] Error messages: option to disable / customize output

The error messages (e.g. "Beginning/End of directory history!") are messing with my prompt. I have to press Enter or run clear to have it restored. Would it be possible to implement some mechanism to disable them or customize where/how they will be printed? E.g. I was thinking about showing them in the rprompt.

An idea: have some variable, say dir:print-error, whose default value would be the current behaviour:

print-error = [msg]{

    echo $msg > /dev/tty
}

and then functions like e.g. back would use it:

fn back {
  if (> $-cursor 0) {
    -cursor = (- $-cursor 1)
    builtin:cd $-dirstack[$-cursor]
  } else {
    $print-error "Beginning of directory history!"   # <= here
  }
}

Then I would be able to override dir:print-error in my rc.elv to implement the behaviour that I want.

`edit:insert:binding[Alt-b] = $dir:&left-word-or-prev-dir` causes error message "Exception: value should be function" regarding `$dir`

In Elvish 0.12 on macOS Sierra 10.13.6, I added the following to ~/.elvish/rc.elv per the dir.org file:

use github.com/zzamboni/elvish-modules/dir
edit:insert:binding[Alt-b] = $dir:&left-word-or-prev-dir
edit:insert:binding[Alt-f] = $dir:&right-word-or-next-dir
edit:insert:binding[Alt-i] = $dir:&dir-chooser

which upon restarting Elvish generates the following error message:

Exception: value should be function
/Users/alchou/.elvish/rc.elv, line 18: edit:insert:binding[Alt-b] = $dir:&left-word-or-prev-dir

wherein the substring $dir: is underlined.

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.