Skip to main content

A library jam for Python.

Project description

libjam

A library jam for Python.

Modules

libjam consists of of 6 modules:

Captain

responsible for handling command-line arguments

Drawer

responsible for file operations

Typewriter

responsible for transforming and printing text

Clipboard

responsible for working with lists

Notebook

responsible for configuration

Flashcard

responsible for getting user input from the command line

Example project

#! /usr/bin/python

# Imports
import sys
from libjam import Captain

captain = Captain()

class CLI:
  def hello(self, text):
    print(text)
    if options.get('world').get('enabled'):
      print('world!')

cli = CLI()

# Inputs/Commands/Options configuration
app = "example"
description = "An example app for the libjam library"
# help = "" # If you wish to set your own help page text
commands = {
  'print':     {'function': cli.hello,
  'description': 'Prints given string'},
}
options = {
 'world': {'long': ['world'], 'short': ['w'],
 'description': 'Appends \'world\' after printing given input'},
}

# Getting program arguments
arguments = sys.argv
# Removing script name from arguments
arguments.remove(arguments[0])
# Generating help
help = captain.generate_help(app, description, commands, options)
# Interpreting user input
interpretation = captain.interpret(app, help, commands, arguments, options)
# Getting parsed output
function = interpretation.get('function')
options = interpretation.get('options')
# Executing function
exec(f"cli.{function}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libjam-0.0.5.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libjam-0.0.5-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file libjam-0.0.5.tar.gz.

File metadata

  • Download URL: libjam-0.0.5.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for libjam-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d27cb4382af3cbd2147a523b5464a75a9bd6b35ca2dace52fe0e10e701ce4c25
MD5 69508719e58f186b40a336e724d5cfa3
BLAKE2b-256 b0d57b4354850fa24b2d4525c98fab45baeb3b70d6db3f15d0de0909b96db6e8

See more details on using hashes here.

File details

Details for the file libjam-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: libjam-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for libjam-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 93272348b9ed157fae00b1afad1c7b3bd8d3372226a36e05cc777ad90f9e25e1
MD5 2c49640e21896301969818a619446b0e
BLAKE2b-256 4f58756e0ce94d3071d6aaf2a622f75d00000395ffc54f3e07c025e1d08d20fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page