DEV Community

AidanSTucker
AidanSTucker

Posted on • Updated on

How You Can Easily Enhance Your Companies Workflow

Creating A Simple & Free Task Manager CLI

Utilizing the power of Python and built in CLI's, you too can create your very own CLI. A CLI or otherwise known as a Command Line Interface is a user portal of sorts thats is ran through your Mac or Windows OS (Terminal for Mac and Linux for Windows). It holds access to all of your computers inner files, and this code is meant to utilize that OS to run it.

My project in particular is a CLI program that is designed to help a company with their task / workload. The project consists of two different classes, users, and tasks. Users have the following attributes (Department and name), and tasks have these following attributes (description, length to complete, and the foreign key to point to the user that is belongs to)

In this CLI, as a user you are able to create and assign tasks to users, as well as complete / delete them. You are also able to create and remove users & or just view the tasks they currently have.

How Does This Benefit "My" Company

For numerous online companies across the US, whether you have 3 employees or 300, chances are you have a regular workload that you need to keep track of. Not tracking the work being done can foresee many issues such as; mistakes in completing the work assigned or missing deadlines, wrong assignees of said work, employees not meeting expectations and taking advantage of a misaligned system, and much more.

By utilizing a free workflow program as such, you avoid all those problems, as well as avoiding incurring the heavy monthly fees of some of the well known workflow programs such as a popular one "Acello".

At it's current base functionality, the main uses of the program are CRUD functions for both the user and task classes. But with additional code implemented, you can completely expand the functionality of the program to add features such as time tracking, deadline reminders, and so much more.

How To Use The CLI

On the lowest level of setup, all you need to do to successfully run the code is git fork and clone the projects repository, then run the code in your terminal window, install the dependencies from the Pipfile using (Pipenv install, then pipenv shell), then finally running python lib/cli.py to ultimately run the code. Any changes made to the code hereafter are kept in the database. For example if you make a new user or a new task, and or update a certain attribute of one of those, then those changes are kept in the database.

By forking your own copy of the project, you can easily remove all the current users, tasks, and even departments etc to put in your own functionality, without affecting the main project source.

Deep Dive Into The Code

The project itself is mainly consisted of the following files:

user.py & task.py (Defining classes)
init.py (initializing file)
helpers.py (file that contains the function library)
cli.py (defines the structure of the cli menu)
company.db (holds all of the data for users and task)
Pipfile (contains the needed dependencies to run the code_
README.md (instruction booklet of the code and how to use it)

In our helpers.py file where all of our functions are defined, we have a simular structure among all of the function definitions:

def get_all_users(): ##Complete
    cursor.execute("SELECT * FROM Users")
    users = cursor.fetchall()
    print(users)
Enter fullscreen mode Exit fullscreen mode

The structure contains the function name, then input value (if one exists) the value we want the cursor to execute, then we create a variable to hold the value of what we just retrieved, then finally the print statement to return the value that we just found.

After this method is created, we have to import to be used in our CLI, first from our import statement;

from helpers import (
    get_all_users,
    ...other methods...
)
Enter fullscreen mode Exit fullscreen mode

Then we create the event handling. If a user selects the menu option (number value we display), then we call the method that is associated with it:

elif choice == "2":
     get_all_users()
Enter fullscreen mode Exit fullscreen mode

So in summary, in our CLI we display a menu with options to do things like view all users, create a user or task, etc. Then when a certain menu option is selected, we call the method which we imported from our helpers.py file where it's created, to run and show the user whatever they were looking for or trying to achieve.

Key Takeaway

With this project, streamline your workload, manage and monitor your employees, departments, and their prospective workload, and enjoy a more organized company.

With the main setup created, all that's left for you, is to create your own users, departments, and start assigning some work. Good luck!

Top comments (0)