Skip to content
forked from tableau/tabcmd

A Python based app that replicates the functionality of the existing TabCMD command line utility

License

Notifications You must be signed in to change notification settings

mkosmicki/tabcmd

 
 

Repository files navigation

Tabcmd

Tableau Supported Code style: black

An open source Python based app that replicates the functionality of the existing Tabcmd command line utility.

Important Note: tabcmd is a work in progress ("beta") which may be useful for test and development purposes, but is not yet recommended for production environments.

For user documentation see https://tableau.github.io/tabcmd/

For developers

Why Python?

Get started

####To work with tabcmd, you need to have Python 3.7+ installed.

To install tabcmd, follow these steps:

  1. Clone the repo
  2. Run pip install .
  • build

python setup.py build

  • run tests

pytest

coverage run -m pytest && coverage report -m

black --line-length 120 tabcmd tests [--check]

  • packaging is done with pyinstaller. You can only build an executable for the platform you build on.

pyinstaller tabcmd.py --clean --noconfirm

produces dist/tabcmd.exe To run tabcmd during development, from a console window in the same directory as the file tabcmd.py:

dist/tabcmd/tabcmd.exe --help

or

  • python -m tabcmd.py [command_name] [--flags]
    • Examples:
      • tabcmd.py login --username [username] --password [password] --server [server_name] --site [site_name]
      • tabcmd.py createproject --name [project_name]
      • tabcmd.py help

For more examples and information about the available commands and options, see the user documentation

Contributions

Code contributions and improvements by the community are welcomed!

See the LICENSE file for current open-source licensing and use information.

Before we can accept pull requests from contributors, we require a signed Contributor License Agreement (CLA).

Project structure

The core design principles for this app are

  • it must provide the functionality of the instance of tabcmd, with drop-in replacement CLI options
  • it should be able to call tsc for all server actions
  • architecture is as simple as possible
  1. tabcmd.py exists only as a module entry point that calls TabCmdController.
  2. the 'parsers' module contains only argument and option definitions, no logic.
  3. the 'commands' module contains the logic required to translate the tabcmd CLI interface into calls to tsc. This is completely dissociated from the parsers, and could theoretically be called from a completely different interface.
  4. The 'execution' module is the core logic. TabcmdController gets an argparse parser, then attaches all the defined parsers to it and associates one command with each parser.

To add a new command

  1. choose the single word that will be used as your command. Let's call this one dream
  2. add parsers/dream_parser.py, and use methods from parent_parser to define the arguments
  3. add commands/dreams/dream_command.py. It must have a method run_command.py(args) and the args object must contain all information needed from the user.
  4. in map_of_parsers.py, add an entry for your new parser, like "dreams": DreamParser.dream_parser
  5. in map_of_commands.py, add an entry for your new command, like "dream": ("dream", DreamCommand, "Think about picnics"),"
  6. add tests!

About

A Python based app that replicates the functionality of the existing TabCMD command line utility

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%