Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality for config command #24

Closed
joshiayush opened this issue Dec 7, 2021 · 0 comments
Closed

Add functionality for config command #24

joshiayush opened this issue Dec 7, 2021 · 0 comments
Assignees
Labels
contributions welcome External contributions are welcome enhancement New feature or request good first issue Good for newcomers

Comments

@joshiayush
Copy link
Owner

Description

def config(self: Command) -> None:
"""Method `config()` stores user's information in database.
This feature is not programed yet. Contributions are welcome.
Args:
self: (Command) Self.
Example:
>>> from argparse import Namespace
>>> from inbparser import Command
>>>
>>> namespace = Namespace(which='config', EMAIL='ayush@gmail.com', PASSWORD='xxx-xxx-xxx')
>>> command = Command(namespace)
>>> command.config()
>>> # -> It should update database with new values
"""
self.logger.info("facility not present")

As of now the config command which is meant to create or update entries in the database does not work. It will be a good feature to implement in conjunction with the delete command and before show command.

Possible solutions

  1. Try to set up a database probably in inb/database, (use SQLite).
  2. Check if we have write permissions or not if not then throw PERM error otherwise follow the below steps.
  3. Check if database exists or not, if it does not then create the following table:
    CREATE TABLE database_name.inb_users(
        Email CHAR(50) PRIMARY KEY NOT NULL,
        Password CHAR(50) NOT NULL,
        CreatedAt DATETIME DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')) 
    );
    Note: Database must be created at the top level directory inside of the db folder.
  4. After the 2 step, insert the fields given by the user.

config command should follow the following command line arguments:

$ inb.py config --email "user_email" --password "user_password"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome External contributions are welcome enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant