Sha256: ae103d300e1c4af39d5f4c560c0c68b6b58db3c6c1f76bddcfb6cc67bc4003cd

Contents?: true

Size: 1.59 KB

Versions: 7

Compression:

Stored size: 1.59 KB

Contents

# frozen_string_literal: true

module Luo
  module CLI
    module Commands
      extend Dry::CLI::Registry

      class Version < Dry::CLI::Command
        desc "Print version"

        def call(*)
          puts Luo::VERSION
        end
      end

      class Init < Dry::CLI::Command
        desc "Init Luo Project"

        def call(*)
          Luo::InitProject.run
        end
      end

      class Commit < Dry::CLI::Command
        desc "Commit with Luo"

        argument :message, desc: "Commit message", required: true, type: :string

        def call(message:, **)
          messages = Messages.create.system(prompt: Luo::Prompts.luo_commit, context: {commit: message}).to_a
          response = OpenAI.new.chat(messages)
          exec "git commit -m '#{response}'"
        end
      end

      class Run < Dry::CLI::Command
        desc "Run Luo"

        def call(*)
          exec "jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root"
        end
      end

      class Bundle < Dry::CLI::Command
        desc "Bundle with Luo"

        def call(*)
          exec "bundle install"
        end
      end

      class Exec < Dry::CLI::Command
        desc "Exec with Luo"
        argument :task, type: :string, required: true

        def call(task: ,**)
          exec task
        end
      end

      register "version", Version, aliases: %w[v -v --version]
      register "commit", Commit, aliases: ["c"]
      register "init", Init, aliases: ["i"]
      register "run", Run, aliases: ["r"]
      register "bundle", Bundle, aliases: ["b"]
      register "exec", Exec, aliases: ["e"]

    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
luo-0.1.25 lib/luo/cli.rb
luo-0.1.24 lib/luo/cli.rb
luo-0.1.23 lib/luo/cli.rb
luo-0.1.22 lib/luo/cli.rb
luo-0.1.21 lib/luo/cli.rb
luo-0.1.20 lib/luo/cli.rb
luo-0.1.18 lib/luo/cli.rb