Skip to content

How can I pump commands through Ripl? #48

@dblock

Description

@dblock

I'm building a command line client for the Strava API, https://github.com/dblock/strava-ruby-cli.

Ripl comes in handy and I could easily throw in strava console that let me delegate anything from my client and do things like athlete.name.

I also would like to be able to just pass these commands on the command line and let Ripl evaluate them for me, without a prompt. How do I do that?

module Strava
  module Cli
    class Console < SimpleDelegator
      attr_reader :client

      def initialize(access_token)
        @client = Strava::Api::Client.new(access_token: access_token)
        super @client
      end

      def run(args)
        # HOW DO I DO THIS?
      end

      def start!
        Ripl.start(binding: binding, prompt: 'Strava> ')
      end
    end
  end
end

I can do this without ripl with just eval here, but it feels wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions