gen
This commit is contained in:
parent
30d6f1b0a2
commit
cffaea5642
5 changed files with 62 additions and 51 deletions
|
|
@ -93,14 +93,12 @@ Who is who in **bin** directory:
|
||||||
- `eman MODULE` shortcut for `erl -man MODULE` (displays the manual page for the Erlang module MODULE)
|
- `eman MODULE` shortcut for `erl -man MODULE` (displays the manual page for the Erlang module MODULE)
|
||||||
- `erun MODULE ARG1 ... ARGN` erlangish `go run`
|
- `erun MODULE ARG1 ... ARGN` erlangish `go run`
|
||||||
- `g+ WHAT` recursively grep current directory
|
- `g+ WHAT` recursively grep current directory
|
||||||
|
- `gen WHAT` generate some code for me (html boilerplate, perl/go snippets, etc)
|
||||||
- `git+ MESSAGE` git: commit and push to master
|
- `git+ MESSAGE` git: commit and push to master
|
||||||
- `go+` go snippet
|
|
||||||
- `h+` transform line to heading
|
- `h+` transform line to heading
|
||||||
- `hg+ MESSAGE` hg: commit and push to master
|
- `hg+ MESSAGE` hg: commit and push to master
|
||||||
- `html+` html boilerplate
|
|
||||||
- `lc+` to lowercase
|
- `lc+` to lowercase
|
||||||
- `nobs+` is taken from plan9 `nobs` (it removes all backspace characters and the characters that precede them)
|
- `nobs+` is taken from plan9 `nobs` (it removes all backspace characters and the characters that precede them)
|
||||||
- `perl+` perl boilerplate (shebang, `use strict` etc)
|
|
||||||
- `put+ BROWSER` regular `Put` plus reload active tab in browser: `ff` | `ch` | `sa`
|
- `put+ BROWSER` regular `Put` plus reload active tab in browser: `ff` | `ch` | `sa`
|
||||||
- `s-` remove leading whitespace
|
- `s-` remove leading whitespace
|
||||||
- `s2t N_SPACES` spaces to tabs (default: 4 spaces to 1 tab)
|
- `s2t N_SPACES` spaces to tabs (default: 4 spaces to 1 tab)
|
||||||
|
|
|
||||||
61
bin/gen
Executable file
61
bin/gen
Executable file
|
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
want="$1"
|
||||||
|
|
||||||
|
## HTML
|
||||||
|
## -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ $want == 'html' ] || [ $want == '!' ]; then
|
||||||
|
cat << 'HTML'
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>title</title>
|
||||||
|
<!-- <link rel="shortcut icon" href="/favicon.ico"> -->
|
||||||
|
<!-- <link rel="stylesheet" href="index.css"> -->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- <script src="index.js"></script> -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
HTML
|
||||||
|
fi
|
||||||
|
|
||||||
|
## PERL
|
||||||
|
## -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ $want == 'perl' ] || [ $want == 'pl' ]; then
|
||||||
|
cat << 'PERL'
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use feature 'say';
|
||||||
|
use experimental 'signatures';
|
||||||
|
|
||||||
|
sub main () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
|
PERL
|
||||||
|
fi
|
||||||
|
|
||||||
|
## GO
|
||||||
|
## -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ $want == 'go' ]; then
|
||||||
|
cat << 'GO'
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
}
|
||||||
|
GO
|
||||||
|
fi
|
||||||
13
bin/go+
13
bin/go+
|
|
@ -1,13 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cat << 'GO'
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
|
|
||||||
}
|
|
||||||
GO
|
|
||||||
16
bin/html+
16
bin/html+
|
|
@ -1,16 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cat << 'HTML'
|
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>title</title>
|
|
||||||
<!-- <link rel="shortcut icon" href="/favicon.ico"> -->
|
|
||||||
<!-- <link rel="stylesheet" href="style.css"> -->
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
HTML
|
|
||||||
19
bin/perl+
19
bin/perl+
|
|
@ -1,19 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
|
|
||||||
$template = <<'TMP';
|
|
||||||
#!/usr/bin/env perl
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
use feature 'say';
|
|
||||||
use experimental 'signatures';
|
|
||||||
|
|
||||||
sub main {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
|
|
||||||
TMP
|
|
||||||
|
|
||||||
print $template;
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue