DEV Community

Discussion on: How I made the CLI app with Python

jasper_zanjani profile image
Jasper Zanjani • Edited on

you could probably do this in a very short shell script

if [ $# != 2 ]
  echo "Usage: tag"
  exit 1; 
  firefox "$1"
neex profile image
neex • Edited on

Hmmm, I am failing to see how writing a shell script will teach you Python.

jasper_zanjani profile image
Jasper Zanjani

I wonder if you were building a house and trying to use a hammer on a screw, would you be such a smartass if I proffered a screwdriver?

Thread Thread
neex profile image

The whole point is that I am not building a house. I want to build one some day, so I practice my skills by building a table. And than a chair. It will cost me $500 in time and materials. I could of course go and pick one up in Ikea for $25 but that will not make building a house any easier.

fronkan profile image
Fredrik Sjöstrand • Edited on

So I came across this and I had to see how short I could make it in Python. This was the shortest I could make it while keeping it nice looking. Here I use start chrome ... as I am running it on a Windows box.

import os
import sys
page = '' if len(sys.argv) < 2 else f'/t/{sys.argv[1]}'
os.system(f'start chrome{page}')