Giter Site home page Giter Site logo

lb-zsh's Introduction

logo

lb-zsh

zsh goodies for LHCb

target audience

A collection of zsh completion functions to make everyday life of zsh users in LHCb easier.

The focus is analysts who use 5% of the options 95% of the time. Experts who need all options of all tools may want to do a bit more.

what's shipped and what's not

The package should not contain general zsh features which are useful outside of LHCb as well. Instead it is planned to contain only features which are useful to LHCb users only.

A border line case is the completion for root.

demo

See my blog post for a screencast.

helpful pointers

When developing the completions, this howto was of great help.

stackoverflow/stackexchange posts which helped:

feature list

git-lb-use

git lb-use completes

  • its command line options (e.g. connection protocol)
  • projects from a list of hard coded projects
  • suggests url stubs (cern gitlab, with its ports)

git-lb-checkout

the git-lb-checkout command gets completed as: git lb-checkout [remote/branch-or-tag] [package-in-remote-project] The first block only querries accessible branches and tags from remotes/projects which were added with lb-use before. Packages get completed from the official list of existing packages, filtered according to the project in the previous argument (when starting with git lb-checkout Stripping/master, only packages associated to the Stripping project get added. It is not checked if they exist in the chosen branch or tag).

getpack

The same function which returns a (shortened) list of packages for git-lb-checkout just provides all packages.

lb-run

lb-run completes projects (from a hard coded list), and suggests version numbers (checking the list of existing versions, starting to suggest from the most recent one). Afterwards, any (currenty) executable command gets completed, and a few common commands get suggested. After that, the completion for the chosen command is called. TODO: add nightly support

lb-dev

just does the first part of lb-run, i.e. no completion after the version number. TODO: add nightly support

lblogin

LbLogin knows about the -c option and has a hard coded list of common CMTCONFIG variables. For afsLbLogin and cvmfsLbLogin that's about it. For LbLogin.sh, also the _gnu_generic function is called to parse the help message and show all documented options.

GUESS

If you're (deep) inside a CMT project path, the GUESS alias will be PROJECT VERSION, which you can use with SetupProject or Lbglimpse.

run

Similarly, the run function searches for the run executable in an lb-dev project. Not to go too wild, I placed barriers not to go beyond $HOME or /. run can handle if it doesn't find run (will return an error instead of wildly running commands). Furhtermore, the run function forwards the exit code of the run executable.

bsub

complete -q and queue names, -R for CentOS7 submission, hint that -J is the job name.

bkill

suggest lxbatch job ids

bjobs

modified default listing

bkillall

function to kill all lxbatch jobs (asks for confirmation)

gaudirun.py

complete .py and .opts files and suggest options from --help

ganga

complete .py files and suggest options from --help

SetupDaVinci (and others)

Similar to lb-run, version numbers (from SetupDaVinci --list-versions) are suggested.

dirac-dms-lfn-accessURL

The two (for me) interesting grid storage elements are completed, such that I don't have to call dirac-dms-lfn-replicas just to look up how the CERN EOS MC storage element is called.

general TODO

None of the commands checks against the current CMTCONFIG.

lb-zsh's People

Contributors

pseyfert avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

blipblipgo

lb-zsh's Issues

mylxplus() doesn't print the host name correctly

mylxplus lxplus111
should print

go to special host
go to host  lxplus111

instead the printout is

go to special host
go to host  l

looks like a copy&paste error from the check for the first letter of the argument.

GUESS functionality for lb-dev directories

SetupProject GUESS certainly has no use for lb-dev directories (that's what the run function does), but calling Lbglimpse with GUESS would be nice. atm this is bound to fail since i'm not filtering out the Dev in the filenames.

lb-run shell usage

Starting shells with lb-run Project version shell is not unproblematic. (the login scripts get sourced again after lb-run defined the correct environment, resulting in bad paths prepended to e.g. the python path). My current workaround is

lb-run Project version shell -f
source .shellrc

This gets the user defined goodies without the system defined problems. Is there a oneliner solution?

sorting of version numbers (for lb-run) fails for one-and-two digit revisions

[ins] pseyfert@lxplus040 ~ > lb-run LHCbDirac v                                                                                                                                                                         16:00:59
project versions:
v8r2p7   v8r2p41  v8r2p4   v8r2p35  v8r2p3   v8r2p27  v8r2p2   v8r2p12  v8r2     v8r1p6   v8r1p4   v8r1p2   v8r1p16  v8r1p14  v8r1p10  v8r0p24  v8r0p22  v8r0p20  v8r0p18                                            
v8r2p6   v8r2p40  v8r2p36  v8r2p32  v8r2p29  v8r2p26  v8r2p13  v8r2p1   v8r1p9   v8r1p5   v8r1p3   v8r1p17  v8r1p15  v8r1p12  v8r1     v8r0p23  v8r0p21  v8r0p19  v0r114                                             

i.e. v8r2p7 appears before v8r2p41

user defined prompt rewritings don'r preserve [Project vVVrRR] prefix

e.g. when using

VIMODE='[ins]'
PROMPT="${VIMODE} %(?..%? )%(!.ROOT.%n)@%m %~ > "
function zle-keymap-select {
 VIMODE="${${KEYMAP/vicmd/[exe]}/(main|viins)/[ins]}"
 PROMPT="${VIMODE} %(?..%? )%(!.ROOT.%n)@%m %~ > "
 zle reset-prompt
}

zle -N zle-keymap-select

(to indicate whether on is in insert or command mode, with the vim line editor) a simple mode switch removes the [Project vVVrRR] prefix (gets only set at shell start time, while toggeling rewrites the prompt.

eos completion tweaking (_hadd)

  • executing macros from eos will tab-complete wrongly, as the prefix root://eoslhcb.cern.ch/ should probably not be prepended to macro paths.
  • wild cards need to be resolved before prepending root://eoslhcb.cern.ch/. i.e. the prefix must get removed, then the wildcard prepended, then the prefix added to all resolutions. globbing prefixes seem to only work with white space ๐Ÿ˜ž, adding a replacements rule to prepend the prefix would probably get too hacky โ€ฆ preexec_functions or zle-line-finish should work, but โ€ฆ that could interfere with user sided modifications and is somewhat hiding the functionality.

hard coded path to pyton script in `_lb-run`

not good. rather have an environment variable which gets a default value in lb-zsh/zshrc if the user didn't provide a value themselves. That should reduce the installation fuzzz (which needs to be documented btw) to a minimum.

nightlies for lb-run and lb-dev

at the moment lb-run and lb-dev very minimalistically only complete project and version number. Their _gnu_generics might also do a good job.

handle options for lb-run

with 38c740d the completion for -l and -c got lost. Furthermore, the hard coded $CURRENT break when options are used at all. These should get filtered at the beginning completely. (possibly stopping completion for -l once the version listing is reached).

improve `bkillall` (adapt to `killall`)

Needed:

  • -q (quiet) Do not complain if no processes were killed.
  • -f (force) Do not prompt (or should it be -y (yes) or -b (batch) )

maybe don't prompt if no processes are available and just return error code (unless -q is specified)

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.