#!/usr/bin/env python
# Install VSCode Extensions from file.
#
# Instead of writing this, could have just written:
#     cat extensions.txt | xargs -L 1 code --install-extension

from __future__ import print_function

import subprocess


EXTENSIONS_FILE = "extensions.txt"


def extensions(filename):
    """ Yield each of the extensions in the given file. """
    with open(filename) as extension_file:
        for extension in extension_file:
            yield extension


def install_extension(extension):
    """ Install the given extension. """
    cmd_list = ["code", "--install-extension", extension]
    print(" ".join(cmd_list), end="")
    subprocess.call(cmd_list, shell=True)


def main():
    for extension in extensions(EXTENSIONS_FILE):
        install_extension(extension)


if __name__ == '__main__':
    main()

#!/usr/bin/env python
# Install VSCode Extensions from file.

from __future__ import print_function

import subprocess


EXTENSIONS_FILE = "extensions.txt"


def extensions(filename):
    """ Yield each of the extensions in the given file. """
    with open(filename) as extension_file:
        for extension in extension_file:
            yield extension


def install_extension(extension):
    """ Install the given extension. """
    cmd_list = ["code", "--install-extension", extension]
    print(" ".join(cmd_list), end="")
    subprocess.call(cmd_list, shell=True)


def main():
    for extension in extensions(EXTENSIONS_FILE):
        install_extension(extension)


if __name__ == '__main__':
    main()

--- 
+++ 
@@ -1,5 +1,8 @@
 #!/usr/bin/env python
 # Install VSCode Extensions from file.
+#
+# Instead of writing this, could have just written:
+#     cat extensions.txt | xargs -L 1 code --install-extension
 
 from __future__ import print_function
 
Add snarky comment in VSCode Extension Installer.
