Last active
February 6, 2024 05:15
-
-
Save sophiabrandt/5c48685277002c1b1ceb618245bfd481 to your computer and use it in GitHub Desktop.
Revisions
-
sophiabrandt revised this gist
May 20, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,7 +44,7 @@ proc cli*() = writeVersion() quit() of "d", "default": discard of "m", "minimal": url = "https://gist.github.com/sophiabrandt/0c68c821631e4203415f85043e29749f/raw/660b9a36f24a6cbd861f28ae861574c5a40b87f5/minimal-readme-template.md" of "t", "template": url = val else: discard -
sophiabrandt renamed this gist
May 20, 2020 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # compile with `nim c -d:ssl readme_template_downloader.nim` import httpclient, parseopt, os @@ -8,18 +8,18 @@ proc downloadTemplate(link: string) = var file = open("README.md", fmWrite) defer: file.close() file.write(client.getContent(link)) echo("Success - downloaded template to README.md.") except IOError as err: echo("Failed to download template: " & err.msg) proc writeHelp() = echo """ README Template Downloader 0.1.0 (download a README Template) Allowed arguments: - h | --help : show help - v | --version : show version - d | --default : dowloads "BEST-README-Template" - m | --minimal : dowloads from https://www.makeareadme.com/ - t | --template : download link for template ("RAW") """ @@ -44,6 +44,7 @@ proc cli*() = writeVersion() quit() of "d", "default": discard of "m", "default": url = "https://gist.github.com/sophiabrandt/0c68c821631e4203415f85043e29749f/raw/660b9a36f24a6cbd861f28ae861574c5a40b87f5/minimal-readme-template.md" of "t", "template": url = val else: discard -
sophiabrandt created this gist
Feb 6, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,56 @@ # compile with `nim -d:ssl readme_template.nim` import httpclient, parseopt, os proc downloadTemplate(link: string) = var client = newHttpClient() try: var file = open("README.md", fmWrite) defer: file.close() file.write(client.getContent(link)) echo("Success - downloaded template to `README.md`.") except IOError as err: echo("Failed to download template: " & err.msg) proc writeHelp() = echo """ README Template Downloader 0.1.0 (download a README Template) Allowed arguments: - h | --help : show help - v | --version : show version - d | --default : dowloads "BEST-README-Template" - t | --template : download link for template ("RAW") """ proc writeVersion() = echo "README Template Downloader 0.1.0" proc cli*() = var url: string = "https://raw.githubusercontent.com/othneildrew/Best-README-Template/master/BLANK_README.md" if paramCount() == 0: writeHelp() quit(0) for kind, key, val in getopt(): case kind of cmdLongOption, cmdShortOption: case key of "help", "h": writeHelp() quit() of "version", "v": writeVersion() quit() of "d", "default": discard of "t", "template": url = val else: discard else: discard downloadTemplate(url) when isMainModule: cli()