Sha256: 3f62204c239a1689cc8a35c0927856039f668a78841368b8cc157343fc30a241

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require "thor"
require "active_support/core_ext/numeric/time.rb"
require "tlapse"
require "tlapse/cli/alpha"
require "tlapse/cli/config"

module Tlapse::CLI
  class CLI < Thor
    desc "doctor", "Perform checks to see if you're ready to tlapse"
    def doctor
      Tlapse::Doctor.doctor
    end

    desc "version", "Print the version number and exit"
    def version
      puts Tlapse::VERSION
    end

    desc "capture_single", "Capture a single photo, saving it to the current directory"
    def capture_single
      Tlapse::Capture.capture_single
    end

    desc "until_sunset", "Generate a gphoto2 command to capture photos from now until the sun sets (useful for cronjobs)"
    option :interval,
      desc: "The interval (in minutes) at which picturs will be taken",
      type: :numeric,
      default: 5,
      aliases: %i(i)
    def until_sunset
      interval = options[:interval].minutes
      puts Tlapse::Capture.timelapse_command_while_sun_is_up(interval: interval)
    end

    desc "config", "Read and write config options"
    subcommand "config", Tlapse::CLI::Config

    desc "alpha", "Get early access to in-development (and likely unstable) commands"
    subcommand "alpha", Tlapse::CLI::Alpha
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tlapse-0.9.0 lib/tlapse/cli/cli.rb
tlapse-0.8.0 lib/tlapse/cli/cli.rb