Skip to content

Instantly share code, notes, and snippets.

@TAJD
Created December 7, 2017 20:46
Show Gist options
  • Save TAJD/544abfe85737d862dbc205574faf0c92 to your computer and use it in GitHub Desktop.
Save TAJD/544abfe85737d862dbc205574faf0c92 to your computer and use it in GitHub Desktop.
import click
@click.group()
def play_music():
pass
@play_music.command()
def hello():
click.echo('Here is our nokia composer! It accepts files containing music notes encoded in the microbit.music format.')
@play_music.command()
@click.argument('filename')
def print_song_file(filename):
"Open a text file containing notes in the microbit format and print it back to the command line."
with open(filename) as f:
s = f.read()
for i in s.split():
print(i)
@play_music.command()
@click.argument('filename')
def open_song_file(filename):
"Open a text file containing notes in the microbit format."
with open(filename) as f:
s = f.read()
return s
if __name__ == '__main__':
play_music()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment