Sha256: e8d72d31ea985c14321631f4c2531f62792c3e09b25d74389a9f74a3d45da4c7

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'commander/import'

program :version, Devcenter::VERSION
program :description, "CLI to interact with Heroku's Dev Center"

require_relative './commands'

command :open do |c|
  c.syntax = 'devcenter open [options]'
  c.summary = 'Open the article with the given slug in the default browser'
  c.description = c.summary
  c.example 'devcenter open process-model', 'Opens https://devcenter.heroku.com/articles/process-model in the default browser'
  c.action do |args, options|
    Devcenter::Commands::Open.run(args[0])
  end
end

command :pull do |c|
  c.syntax = 'devcenter pull [options]'
  c.summary = 'Save an editable copy of an article in your current directory'
  c.description = c.summary
  c.example 'devcenter pull process-model', 'Saves the content of the article with the "process-model" slug to a local process-model.md file in the current directory'
  c.option '--force', 'Skip confirmation and overwrite existing local file'
  c.action do |args, options|
    options.default :force => false
    Devcenter::Commands::Pull.run(args[0], options.force)
  end
end

command :preview do |c|
  c.syntax = 'devcenter preview [options]'
  c.summary = 'Opens a live preview for a given article file'
  c.description = c.summary
  c.example 'devcenter preview process-model', 'Opens a live preview of the local process-model.md file'

  c.option '--host HOST', String, 'Host where the preview will be available'
  c.option '--port PORT_NUMBER', Integer, 'Port where the preview will be available'
  c.action do |args, options|
    options.default :host => '127.0.0.1', :port => 3000
    Devcenter::Commands::Preview.run(args[0], options.host, options.port)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devcenter-0.0.2 lib/devcenter/cli.rb
devcenter-0.0.1 lib/devcenter/cli.rb