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

suppress $id expansion #113

Open
no6v opened this issue Apr 4, 2012 · 2 comments
Open

suppress $id expansion #113

no6v opened this issue Apr 4, 2012 · 2 comments

Comments

@no6v
Copy link
Collaborator

no6v commented Apr 4, 2012

How can I tweet $id, instead of for instance 187363363188248580?

 :update $id
update '187363363188248580' [Yn] n
 :update \$id
update '\187363363188248580' [Yn] n

I investigated it and got the idea to suppress this.
Currently, below sequence is resulted to "Command not found".

 : :update $id
Command not found

The patch below makes ⚡ : (start with colon + space) as a signal not to expand the typable id.

 : :update $id
update '$id' [Yn] n

However, with this patch, we cannot use :reply, (quoted) :retweet, and more perhaps.
Those require the $id to determine the target tweet. One more thing, some commands
are using input() internally, then the input_filter will be applied twice.
Any idea?

Also available: https://gist.github.com/2237938

diff --git a/lib/earthquake/input.rb b/lib/earthquake/input.rb
index 870cefc..9469c25 100644
--- a/lib/earthquake/input.rb
+++ b/lib/earthquake/input.rb
@@ -141,6 +141,7 @@ module Earthquake
     end

     input_filter do |text|
+      next text if text.sub!(/\A: /, "")
       if text =~ %r|^(:\w+)|
         if target = command_aliases[$1]
           text = text.sub(%r|^:\w+|, target)

I don't want to introduce any escape sequences, though ;-).

@ohac
Copy link

ohac commented Apr 5, 2012

How about this patch?

https://gist.github.com/2310338

⚡ test $ab $$ab $ab $$ab
update 'test 187870166942613506 $ab 187870166942613506 $ab' [Yn] n

@no6v
Copy link
Collaborator Author

no6v commented Apr 5, 2012

Can you tweet '$$ab' with this patch? This is exactly escape sequance, I guess.
But this may be enough solution as usual tweet life :).

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

2 participants