1
0
Fork 0
mirror of synced 2024-06-18 06:41:08 -04:00
zimfw/src/zimfw.zsh.erb
Eric Nielsen ee99fe8a36
Add -v (verbose) option
so the normal output is focused on the given action, and output for
additional steps perfomed after the given action is only shown in
verbose mode.

Also, the output of wget is only shown in verbose mode. This is because
wget always shows some output (to stderr) even when there are no errors.
See https://serverfault.com/q/70889/302338

This should give a friendlier output.
See #360
2020-01-11 16:34:36 -05:00

40 lines
1,003 B
Plaintext

<%
class Zim
attr_reader :home, :min_zsh_version, :startup_files_glob, :version, :ellipsis, :okay, :error, :done, :failed
def initialize
@home = "${ZDOTDIR:-${HOME}}"
@min_zsh_version = "5.2"
@startup_files_glob = ".z(shenv|profile|shrc|login|logout)"
@version = "1.1.0-SNAPSHOT"
@ellipsis = " ..."
@okay = "%F{green})%f "
@error = "x "
@done = ""
@failed = ""
end
def render(filename)
ERB.new(File.read(filename)).result(binding)
end
def render_all(pattern)
Dir[pattern].sort.map { |filename| render(filename) }.join("\n")
end
def render_escaped(filename)
render(filename).gsub(/(?=\$[^']|"|`)/, "\\\\")
end
def render_commented(filename)
render(filename).gsub(/^(?=.)/, "# ").gsub(/^$/, "#")
end
end
zim = Zim.new
%># AUTOMATICALLY GENERATED FILE. EDIT ONLY THE SOURCE FILES AND THEN COMPILE.
# DO NOT DIRECTLY EDIT THIS FILE!
<%= zim.render_commented("LICENSE") %>
<%= zim.render_all("src/stage2/*.erb") %>
zimfw "${@}"