113 lines
4.7 KiB
HTML
113 lines
4.7 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>the shell spellbook</title>
|
|
<link rel="stylesheet" type="text/css" href="../theme.css" />
|
|
<link rel="stylesheet" type="text/css" href="highlight.css" />
|
|
<link rel="shortcut icon" type="image/x-icon" href="../img/favicon.ico"/>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="author" content="~lucidiot" />
|
|
<meta name="generator" content="aliasindex/0.1" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<style type="text/css">
|
|
pre {
|
|
white-space: pre-wrap;
|
|
}
|
|
.highlighttable table, .highlighttable tbody, .highlighttable tr, .highlighttable td {
|
|
vertical-align: top;
|
|
}
|
|
.highlighttable pre {
|
|
margin: 0;
|
|
}
|
|
.linenos {
|
|
color: gray;
|
|
}
|
|
a.toplink {
|
|
font-family: monospace;
|
|
font-size: 80%;
|
|
float: right;
|
|
}
|
|
a.toplink + h1, a.toplink + h2 {
|
|
margin-top: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
{% macro funchighlight(func) -%}
|
|
{% highlight 'zsh',lineno='table' %}
|
|
function {{ func.name|quote }} () {
|
|
{{ func.value|indent(first=True) }}
|
|
}
|
|
{% endhighlight %}
|
|
{% endmacro %}
|
|
{% macro printalias(alias) -%}
|
|
{% if alias.type == 'git' %}
|
|
<h3>git {{ alias.name }}</h3>
|
|
{% else %}
|
|
<h3>{{ alias.name }}</h3>
|
|
{% endif %}
|
|
{% if alias.description %}
|
|
{% markdown %}{{ alias.description|safe }}{% endmarkdown %}
|
|
{% endif %}
|
|
{% if alias.type == 'git' %}
|
|
{% highlight 'zsh' %}git config --global {{ ('alias.' + alias.name)|quote }} {{ alias.value|quote }}{% endhighlight %}
|
|
{% elif alias.type == 'function' %}
|
|
{% autoescape false %}
|
|
{{ funchighlight(alias)|replace('\n', '<br />') }}
|
|
{% endautoescape %}
|
|
{% elif alias.type == 'alias' %}
|
|
{% highlight 'zsh' %}alias {{ alias.name|quote }}={{ alias.value|quote }}{% endhighlight %}
|
|
{% else %}
|
|
{% highlight 'zsh' %}{{ alias.value }}{% endhighlight %}
|
|
{% endif %}
|
|
{%- endmacro %}
|
|
{% macro section(title, slug='', description='', aliases=[]) -%}
|
|
<div class="section" id="{{ slug|default(title|slug, true) }}">
|
|
<a href="#contents" class="toplink">back to top</a>
|
|
<h2>{{ title }}</h2>
|
|
{% if description %}
|
|
{% markdown %}{{ description|safe }}{% endmarkdown %}
|
|
{% endif %}
|
|
{% for alias in aliases|sort(attribute='name') %}
|
|
{{ printalias(alias) }}
|
|
{% endfor %}
|
|
</div>
|
|
{%- endmacro %}
|
|
<body class="container">
|
|
<h1>the shell spellbook</h1>
|
|
<p>
|
|
<strong>{{ data.aliases|selectattr('private', 'eq', False)|selectattr('type', 'eq', 'alias')|list|length }}</strong> aliases,
|
|
<strong>{{ data.aliases|selectattr('private', 'eq', False)|selectattr('type', 'eq', 'git')|list|length }}</strong> git aliases,
|
|
<strong>{{ data.aliases|selectattr('private', 'eq', False)|selectattr('type', 'eq', 'function')|list|length }}</strong> functions
|
|
<br />
|
|
last updated: <tt>{{ timestamp }}</tt>
|
|
</p>
|
|
<div class="section" id="contents">
|
|
<p>This page holds a collection of shell aliases and functions I use regularly. I will soon write a sync script to automatically update my alias collection on every computer I use to turn this into an over-engineered alias management system.</p>
|
|
<p>This is generated using <a href="https://jinja.palletsprojects.com/" target="_blank"><tt>jinja2</tt></a> from a YAML file of mine. Note that some aliases might have a strange escaping because I escape them using Python's <a href="https://docs.python.org/3/library/shlex.html" target="_blank"><tt>shlex</tt></a> module.</p>
|
|
<h2>contents</h2>
|
|
<ul>
|
|
{% for tag in data.tags|sort(attribute='name') %}
|
|
<li>
|
|
<a href="#{{ tag.name|slug }}">{{ tag.name }}</a>
|
|
{% if tag.description %}
|
|
<br />
|
|
{{ tag.description }}
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
{% if data.aliases|selectattr('private', 'eq', False)|selectattr('tag', 'none')|list|length %}
|
|
<li><a href="#__uncategorized__">uncategorized</a></li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
|
|
{% for tag in data.tags|sort(attribute='name') %}
|
|
{{ section(tag.name, tag.name|slug, tag.description, data.aliases|selectattr('private', 'eq', False)|selectattr('tag', 'eq', tag.name)|list) }}
|
|
{% endfor %}
|
|
|
|
{% if data.aliases|selectattr('private', 'eq', False)|selectattr('tag', 'none')|list|length %}
|
|
{{ section('uncategorized', '__uncategorized__', '', data.aliases|selectattr('private', 'eq', False)|selectattr('tag', 'none')|list) }}
|
|
{% endif %}
|
|
</body>
|
|
</html>
|