cf-table 0.1.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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/bin/cf-table +7 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/cf-table.gemspec +26 -0
- data/exe/cf-table +7 -0
- data/lib/cf/table.rb +7 -0
- data/lib/cf/table/cli.rb +53 -0
- data/lib/cf/table/version.rb +5 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 02efc4388759dd1c58dcc1d5602b89675c26a542
|
4
|
+
data.tar.gz: 08aea397cb7bf06e95334c015b6225adc8e51404
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 60cd7bf2adb5d74a227626a1ded351ad75b98d756d6d016b67a47cc52591c9bd9497fbf6df3cbdffde56d273eeeb43eb0951b650afa69a0a3315cecaffc98631
|
7
|
+
data.tar.gz: ae0d63a432c641fbab5ffc8541b67c92210fbe6da8c2c8d15f199c1cf4fefcc4ebe9574d09bc43fede1825f46b67950b0aeba41d2d22f655574c0b8d2600af73
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# CF Table
|
2
|
+
Simple cli for show the results from `cf curl` in a table.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
```shell
|
7
|
+
gem install cf-table
|
8
|
+
```
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
```shell
|
13
|
+
> cf curl /v2/apps | cf-table
|
14
|
+
Table to wide, please select some columns:
|
15
|
+
+----------------------------+-------------------------+-------------------+----------------------+------------------------+
|
16
|
+
| name | production | space_guid | stack_guid | buildpack |
|
17
|
+
| detected_buildpack | environment_json | memory | instances | disk_quota |
|
18
|
+
| state | version | command | console | debug |
|
19
|
+
| staging_task_id | package_state | health_check_type | health_check_timeout | staging_failed_reason |
|
20
|
+
| staging_failed_description | diego | docker_image | package_updated_at | detected_start_command |
|
21
|
+
| enable_ssh | docker_credentials_json | ports | space_url | stack_url |
|
22
|
+
| events_url | service_bindings_url | routes_url | | |
|
23
|
+
+----------------------------+-------------------------+-------------------+----------------------+------------------------+
|
24
|
+
|
25
|
+
> cf curl /v2/apps | cf-table name detected_buildpack
|
26
|
+
+---------------------+--------------------+
|
27
|
+
| name | detected_buildpack |
|
28
|
+
+---------------------+--------------------+
|
29
|
+
| starkandwayne-ghost | Node.js |
|
30
|
+
| trycf | |
|
31
|
+
| trycf-dashboard | |
|
32
|
+
| cisco-training | |
|
33
|
+
| github-shields | Go |
|
34
|
+
| training | |
|
35
|
+
| simple-go-web-app | Go |
|
36
|
+
| training-preview | |
|
37
|
+
| starkandwayne | |
|
38
|
+
| stannis-ge | go 1.6.0 |
|
39
|
+
| spruce | |
|
40
|
+
+---------------------+--------------------+
|
41
|
+
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cloudfoundry-community/cf-table.
|
data/Rakefile
ADDED
data/bin/cf-table
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cf/table"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/cf-table.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cf/table/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cf-table"
|
8
|
+
spec.version = CF::Table::VERSION
|
9
|
+
spec.authors = ["Ruben Koster"]
|
10
|
+
spec.email = ["rkoster@starkandwayne.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Simple cli for show the results from `cf curl` in a table.}
|
13
|
+
spec.description = %q{Simple cli for show the results from `cf curl` in a table.}
|
14
|
+
spec.homepage = "https://github.com/cloudfoundry-community/cf-table"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'terminal-table'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
end
|
data/exe/cf-table
ADDED
data/lib/cf/table.rb
ADDED
data/lib/cf/table/cli.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'terminal-table'
|
3
|
+
require 'pp'
|
4
|
+
|
5
|
+
module CF::Table
|
6
|
+
class CLI
|
7
|
+
def self.run
|
8
|
+
if table.send(:columns_width) > term_cols
|
9
|
+
puts "Table to wide, please select some columns:"
|
10
|
+
puts keys_table
|
11
|
+
else
|
12
|
+
puts table
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.table
|
17
|
+
@table ||= Terminal::Table.new headings: columns, rows: rows
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.keys_table
|
21
|
+
rows = (entity_keys + Array.new(5 - (entity_keys.size % 5))).each_slice(5)
|
22
|
+
Terminal::Table.new rows: rows
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.rows
|
26
|
+
entities.map do |entry|
|
27
|
+
columns.map { |column| entry[column] }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.columns
|
32
|
+
@columns ||= ARGV.empty? ? default_columns : ARGV
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.default_columns
|
36
|
+
entity_keys.select { |k| !k.match(/url$/) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.entity_keys
|
40
|
+
@entity_keys || entities.first.keys
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.entities
|
44
|
+
@entities ||= begin
|
45
|
+
JSON.parse($stdin.read)['resources'].map { |entity| entity['entity'] }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.term_cols
|
50
|
+
`tput cols`.strip.to_i
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cf-table
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ruben Koster
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: terminal-table
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Simple cli for show the results from `cf curl` in a table.
|
70
|
+
email:
|
71
|
+
- rkoster@starkandwayne.com
|
72
|
+
executables:
|
73
|
+
- cf-table
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/cf-table
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- cf-table.gemspec
|
87
|
+
- exe/cf-table
|
88
|
+
- lib/cf/table.rb
|
89
|
+
- lib/cf/table/cli.rb
|
90
|
+
- lib/cf/table/version.rb
|
91
|
+
homepage: https://github.com/cloudfoundry-community/cf-table
|
92
|
+
licenses: []
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.4.5.1
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Simple cli for show the results from `cf curl` in a table.
|
114
|
+
test_files: []
|