CSS.PY - THE CSS DATA TERMINAL

Description:

The CSS Data Terminal provides the user with information on different usages of CSS elements in a command-line format.

Description

The CSS Data Terminal is a Python program that acts as a terminal might on a Mac or Linux computer. Similar to the “help” function that you can find in these programs, this is the “help” program for CSS.

Table of Contents

  1. How Does It Work?
  2. How to Run the Program
  3. What Did I Learn?

How Does It Work?

When using the program, you are greeted with the main interface which prompts the user to either type in their own command or help to view the full list of commands. When the user types in “help”, they are greeted by the list of commands which include the following:

  • help: Display this help menu.
  • exit: Exit the program.
  • category : Search by category (terms, selectors, at-rule, property, values).
  • letter : Search by the first letter in all categories or a specific category.
  • describe : Get the description and example of a specific term.
  • acknowledgements: Display the acknowledgements for this program.

By running the “describe” command with the item that the user wants to know more about, the program then searches for this and gives its description and a single example of how to use the item whether it be a selector, at-rule, property, or value. Only terms do not have examples as it acts more of a dictionary instead.

Originally, I wanted to include all possible values for each selector, at-rule, and property, but I soon realized that not only was it too cumbersome but also impractical or repetetive. Thus, I chose for only one example for each and later added the values category. For now, it is complete, but I hope that in the future I can add more values to the JSON in order to make it more comprehensive.

How to Run the Program

In order to run the program, type into the command line “python css.py” or “python3 css.py”. If you don’t have Python installed, you can download it at https://www.python.org/

Once you have the program open and running, you are prompted for a command. At this screen you may type ‘describe ' or type 'help' for more information on the commands.

  • ‘help’ displays the help menu
  • ‘exit’ will close the program
  • ‘category <terms/selectors/at-rule/property/values>’ will show all possible items within each of those categories. While listed one after another, you may only use one of the categories at a time.
  • ‘letter ' will display all items that start with that first letter and if added, specific to the category in which you are searching.
  • ‘describe ' will display the information about that particular item.
  • ‘acknowledgements’ will show the creator’s information as well as contributors to this project.

The program will continue to run until the user specifically types in the ‘exit’ command or CTRL + C.

What Did I Learn?

As I was making this program, I learned a lot about Python, JSON files, and CSS. I started making the basic parts of the program while I was still taking the CS50x course and understood that having a CSS program running locally that I could consult on how to use the different properties, for example, would be extremely useful.

At first, I just started creating a “dictionary” as a .txt file but eventually it grew into using a JSON. I also considered using a .db but that would have required SQL instead, which I didn’t think would be as practical or easy to insert new data going forward. Eventually, as I began creating my JSON file, the basic functions of the Python program began to take shape.

For me, this is a very useful and meaningful program that I can use for the future. It was a great joy to actually create something that is - not only new and uncreated to my knowledge - but somthing useful and valuable to my own current working context. I look forward to using and learning from this more and more in the future as I continue to use this as a resource to add to as well as reminding myself.

Moving forward, I think having a quiz feature might be a good feature as well where the program could give the description and the user has to type in the name of the item it is about, but this will be for the future.