terutil 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/newf +43 -0
- data/bin/swap +38 -0
- data/lib/remember.rb +1 -1
- data/lib/terutil.rb +0 -1
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a10417f8feb477431204d0f22310b8be994343dc52d8f9ec7cbcbb92855a29ad
|
|
4
|
+
data.tar.gz: 72bfece42cafd9cda72de99eac449916c87e08d3bbade23f347ec877cbd46a33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1260c75df421f20d367d78b07577b27eb5e485da00167f271187b3b5d8d1e2dd8c0abf447988a24dacdb8fe79165e0259235969eb429bfbed40b3eb3fad99304
|
|
7
|
+
data.tar.gz: 8e2a71fdc32f99f38c4723595f822e0c9fb5e7ca41e8b1298f52760a05beff097b0a8fa479808878faba8d71c3677a209cc0d716bbad290fc5cf03b3c536a240
|
data/bin/newf
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#! /usr/bin/ruby
|
|
2
|
+
require 'terutil'
|
|
3
|
+
include TerUtil
|
|
4
|
+
|
|
5
|
+
def main
|
|
6
|
+
if ARGV.length != 2
|
|
7
|
+
usage
|
|
8
|
+
exit
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
conf, fname = ARGV
|
|
12
|
+
|
|
13
|
+
if File.exist? fname
|
|
14
|
+
puts "Cannot write to '#{fname}': File exists"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
header = Remember.read "newf/#{conf}"
|
|
18
|
+
if header == nil
|
|
19
|
+
puts <<~END
|
|
20
|
+
No configuration with name '#{conf}'.
|
|
21
|
+
To add this configuration, use:
|
|
22
|
+
remember "newf/#{conf}" <your file header>
|
|
23
|
+
END
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
File.write fname, header
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def usage
|
|
30
|
+
puts <<~END
|
|
31
|
+
Usage:
|
|
32
|
+
newf <configuration name> <file name>
|
|
33
|
+
|
|
34
|
+
To add a configuration:
|
|
35
|
+
remember newf/<configuration name> <file header>
|
|
36
|
+
|
|
37
|
+
Example:
|
|
38
|
+
remember newf/ruby "#! /usr/bin/ruby\\n\\n"
|
|
39
|
+
END
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
main
|
|
43
|
+
|
data/bin/swap
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#! /usr/bin/ruby
|
|
2
|
+
require 'tempfile'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
def main
|
|
6
|
+
if ARGV.length != 2
|
|
7
|
+
usage
|
|
8
|
+
exit
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
f1, f2 = ARGV
|
|
12
|
+
if !File.file? f1
|
|
13
|
+
puts "File '#{f1}' #{if File.directory? f1 then 'is a directory' else 'does not exist' end}."
|
|
14
|
+
exit 1
|
|
15
|
+
end
|
|
16
|
+
if !File.file? f2
|
|
17
|
+
puts "File '#{f2}' #{if File.directory? f2 then 'is a directory' else 'does not exist' end}."
|
|
18
|
+
exit 1
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
tmp = Tempfile.new f1
|
|
22
|
+
tmp.close
|
|
23
|
+
tmp = tmp.path
|
|
24
|
+
|
|
25
|
+
FileUtils.mv f1, tmp
|
|
26
|
+
FileUtils.mv f2, f1
|
|
27
|
+
FileUtils.mv tmp, f2
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def usage
|
|
31
|
+
puts <<~END
|
|
32
|
+
Usage:
|
|
33
|
+
swap <file1> <file2>
|
|
34
|
+
END
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
main
|
|
38
|
+
|
data/lib/remember.rb
CHANGED
data/lib/terutil.rb
CHANGED
metadata
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: terutil
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- vypxl
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-08-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|
|
15
15
|
executables:
|
|
16
16
|
- remember
|
|
17
17
|
- _c
|
|
18
|
+
- swap
|
|
19
|
+
- newf
|
|
18
20
|
extensions: []
|
|
19
21
|
extra_rdoc_files: []
|
|
20
22
|
files:
|
|
21
23
|
- bin/_c
|
|
24
|
+
- bin/newf
|
|
22
25
|
- bin/remember
|
|
26
|
+
- bin/swap
|
|
23
27
|
- lib/remember.rb
|
|
24
28
|
- lib/terutil.rb
|
|
25
29
|
homepage: https://github.com/vypxl/terutil
|
|
@@ -42,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
42
46
|
- !ruby/object:Gem::Version
|
|
43
47
|
version: '0'
|
|
44
48
|
requirements: []
|
|
45
|
-
rubygems_version: 3.0.
|
|
49
|
+
rubygems_version: 3.0.6
|
|
46
50
|
signing_key:
|
|
47
51
|
specification_version: 4
|
|
48
52
|
summary: Terminal Util - a collection of useful terminal utilities.
|