File: localhost.rb

package info (click to toggle)
ruby-localhost 1.1.9-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,452 kB
  • sloc: ruby: 321; makefile: 4
file content (31 lines) | stat: -rw-r--r-- 682 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

# List all local authorities.
def list
	require_relative '../lib/localhost'
	
	terminal = self.terminal
	
	Localhost::Authority.list do |authority|
		terminal.print(
			:hostname, authority.hostname, " ",
			:name, authority.name, "\n", :reset,
			"\tCertificate Path: ", authority.certificate_path, "\n",
			"\t        Key Path: ", authority.key_path, "\n",
			"\t         Expires: ", authority.certificate.not_after, "\n",
			:reset, "\n"
		)
	end
end

private

def terminal(out = $stdout)
	require 'console/terminal'
	
	terminal = Console::Terminal.for(out)
	
	terminal[:hostname] = terminal.style(nil, nil, :bold)
	terminal[:name] = terminal.style(:blue)
	
	return terminal
end