Skip to content

Instantly share code, notes, and snippets.

@nick-brady
Last active March 20, 2018 17:51
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 nick-brady/5faa6e360ad9cabf2087944b6814cdfa to your computer and use it in GitHub Desktop.
Save nick-brady/5faa6e360ad9cabf2087944b6814cdfa to your computer and use it in GitHub Desktop.
dumb script for writing the boilerplate javascript to log out the arguments in a function
# python console.py arg1, arg2, arg3, arg4
import sys
def cleanString(string):
if string[-1] == ',':
return string[:-1]
else:
return string
def eslintDisable():
print('// eslint-disable-next-line')
cleaned_arguments = [cleanString(s) for s in sys.argv[1:]]
eslintDisable()
print('console.group(\'generated console group\');')
for argument in cleaned_arguments:
eslintDisable()
print('console.log(\'{}: \', {});'.format(argument, argument))
eslintDisable()
print('console.groupEnd(\'end group\');')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment