Skip to content

Instantly share code, notes, and snippets.

@tdg5
Created February 25, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdg5/38ebca3dce9e565f8938 to your computer and use it in GitHub Desktop.
Save tdg5/38ebca3dce9e565f8938 to your computer and use it in GitHub Desktop.
alternative means of adding tagging to rails console comand
# Add to require from script/rails before rails/commands is required.
if /^c(?:onsole)?$/ === ARGV[0] && index = ARGV.index { |arg| /-(t|-tag)/ === arg }
# Intercept the arguments vector before it is passed to Rails::Console.
# Drop the -t or --tag arg and following argument which should be the tag
# itself. That's all that should need to be done because the tag will show up
# in the command name given how the command was invoked.
ARGV.slice!(index, 2)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment