lib/dexter/client.rb in pgdexter-0.4.2 vs lib/dexter/client.rb in pgdexter-0.4.3

- old
+ new

@@ -25,10 +25,12 @@ elsif options[:pg_stat_statements] # TODO support streaming option Indexer.new(options).process_stat_statements elsif options[:pg_stat_activity] Processor.new(:pg_stat_activity, options).perform + elsif options[:log_table] + Processor.new(:log_table, options).perform elsif arguments.any? ARGV.replace(arguments) Processor.new(ARGF, options).perform else Processor.new(STDIN, options).perform @@ -38,40 +40,56 @@ def parse_args(args) opts = Slop.parse(args) do |o| o.banner = %(Usage: dexter [options]) o.separator "" - o.separator "Options:" + + o.separator "Input options:" + o.string "--input-format", "input format", default: "stderr" + o.string "--log-table", "log table (experimental)" + o.boolean "--pg-stat-activity", "use pg_stat_activity", default: false, help: false + o.boolean "--pg-stat-statements", "use pg_stat_statements", default: false, help: false + o.string "-s", "--statement", "process a single statement" + o.separator "" + + o.separator "Connection options:" + o.string "-d", "--dbname", "database name" + o.string "-h", "--host", "database host" + o.integer "-p", "--port", "database port" + o.string "-U", "--username", "database user" + o.separator "" + + o.separator "Processing options:" + o.integer "--interval", "time to wait between processing queries, in seconds", default: 60 + o.float "--min-calls", "only process queries that have been called a certain number of times", default: 0 + o.float "--min-time", "only process queries that have consumed a certain amount of DB time, in minutes", default: 0 + o.boolean "--once", "run once", default: false, help: false + o.separator "" + + o.separator "Indexing options:" o.boolean "--analyze", "analyze tables that haven't been analyzed in the past hour", default: false o.boolean "--create", "create indexes", default: false o.array "--exclude", "prevent specific tables from being indexed" o.string "--include", "only include specific tables" - o.string "--input-format", "input format", default: "stderr" - o.integer "--interval", "time to wait between processing queries, in seconds", default: 60 + o.integer "--min-cost-savings-pct", default: 50, help: false + o.string "--tablespace", "tablespace to create indexes" + o.separator "" + + o.separator "Logging options:" o.boolean "--log-explain", "log explain", default: false, help: false o.string "--log-level", "log level", default: "info" o.boolean "--log-sql", "log sql", default: false - o.float "--min-calls", "only process queries that have been called a certain number of times", default: 0 - o.float "--min-time", "only process queries that have consumed a certain amount of DB time, in minutes", default: 0 - o.integer "--min-cost-savings-pct", default: 50, help: false - o.boolean "--pg-stat-activity", "use pg_stat_activity", default: false, help: false - o.boolean "--pg-stat-statements", "use pg_stat_statements", default: false, help: false - o.string "-s", "--statement", "process a single statement" - o.string "--tablespace", "tablespace to create indexes" + o.separator "" + + o.separator "Other options:" o.on "-v", "--version", "print the version" do log Dexter::VERSION exit end o.on "--help", "prints help" do log o exit end - o.separator "" - o.separator "Connection options:" - o.string "-d", "--dbname", "database name" - o.string "-h", "--host", "database host" - o.integer "-p", "--port", "database port" - o.string "-U", "--username", "database user" end arguments = opts.arguments options = opts.to_hash