elves / upgrade-scripts-for-0.7 Goto Github PK
View Code? Open in Web Editor NEWFixing code written before version 0.7
Fixing code written before version 0.7
The syntax changes made in the 0.7 release broke a function in one of my scripts that this tool possibly overlooked (not sure if it would fall under the scope of this tool or my script just has a weird edgecase).
The code snippet in question is
fn commit-count {
splits &sep="\t" (git rev-list --count --left-right "@{upstream}...HEAD" 2>/dev/null)
}
fn ahead {
if (is-detached) {
put detached; return
}
try {
{commits-behind,commits-ahead} = (commit-count)
} except {
put none; return
}
if (== $commits-behind 0) {
if (== $commits-ahead 0) {
put none
} else {
put ahead
}
} else {
if (== $commits-ahead 0) {
put behind
} else {
put diverged
}
}
}
The line in the try
block {commits-behind,commits-ahead} = (commit-count)
given the following error when launching elvish:
Exception: Compilation error: must be an lvalue
/home/vendion/.elvish/lib/git.elv, line 100:
{commits-behind,commits-ahead} = (commit-count)
Traceback:
/home/vendion/.elvish/rc.elv, line 8:
use git
In case you need them here are the full scripts that are affected git.elv and git-prompt.elv
I'm not sure what the new syntax is for doing a multiple assignment from a function call is now, or if that is still even possible. Other than this issue the tool to update the scripts seemed to work nicely.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.