Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I pump commands through Ripl? #48

Open
dblock opened this issue Jan 11, 2019 · 0 comments
Open

How can I pump commands through Ripl? #48

dblock opened this issue Jan 11, 2019 · 0 comments

Comments

@dblock
Copy link

dblock commented Jan 11, 2019

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.

@dblock dblock changed the title How can I pump code through Ripl? How can I pump commands through Ripl? Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant