This commit is contained in:
Ev Bogdanov 2017-02-18 21:50:50 +03:00
parent 30d6f1b0a2
commit cffaea5642
5 changed files with 62 additions and 51 deletions

View file

@ -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)
- `erun MODULE ARG1 ... ARGN` erlangish `go run`
- `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
- `go+` go snippet
- `h+` transform line to heading
- `hg+ MESSAGE` hg: commit and push to master
- `html+` html boilerplate
- `lc+` to lowercase
- `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`
- `s-` remove leading whitespace
- `s2t N_SPACES` spaces to tabs (default: 4 spaces to 1 tab)

61
bin/gen Executable file
View 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+
View file

@ -1,13 +0,0 @@
#!/usr/bin/env bash
cat << 'GO'
package main
import (
"fmt"
)
func main() {
}
GO

View file

@ -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

View file

@ -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;