Skip to content
This is an unofficial memsource-cli-client project.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
docs
memsource_cli
test Fix for test_vendor.py unit test Oct 2, 2019
.gitignore
.gitreview [0.2rc] First release Sep 24, 2019
.travis.yml
CHANGELOG.md [0.2.10] Project template show added Nov 11, 2019
CONTRIBUTING.md
LICENSE Initial commit Sep 22, 2019
README.md [0.2.10] Project template show added Nov 11, 2019
requirements.txt automatic builds using travis on pypi and pbr versioning Oct 2, 2019
setup.cfg [0.2.10] Project template show added Nov 11, 2019
setup.py
sonar-project.properties Create sonar-project.properties Oct 5, 2019
test-requirements.txt Update test-requirements.txt Oct 5, 2019
tox.ini Update tox.ini Oct 5, 2019

README.md

Unofficial Memsource CLI client

GitHub Coverage Status Build Status PyPI version GitHub release (latest by date) Unofficial Memsource CLI Telegram Group Google group : Unofficial Memsource CLI Forum Quality Gate Status Codacy Badge

Table of contents

Introduction

Memsource CLI is a framework to help with automation of Memsource related tasks. This empowers you to automate repetitive tasks such as project, job creation, analysis runs and others. The framework is cabable to talk to Memsource API using REST client and show you the results of the execution on the screen.

Please if you have any idea on any improvements please do not hesitate to open an issue.

Releases

Highlights

  • Extensions are written in Python
  • Allows you to use formatter -f to choose one of many different formats: csv,json,table,value,yaml
  • You can sort by any individual columns or multiple columns using --sort-column
  • Specify the columns that you are interested in using -c

Framework will download additional packages:

  • cliff
  • certifi>=2017.4.17
  • python-dateutil>=2.1
  • six>=1.10
  • urllib3>=1.23

What's new

Version 0.2.10

[0.2.10] Adding feature template show

Added new features such as

Version 0.2.9

[0.2.9] Adding feature job translations delete all
[0.2.9] Job download renamed
[0.2.9] Add Translation pre-translate option
[0.2.9] Customized output directory for file downloads
[0.2.9] Fix to datetime JSON serialization
[0.2.9] Minor fix: invalid JSON in references in memsource project list

Added features such as

Version 0.2.8

Fixed #6 [BUG] A CLI returns invalid JSON with single-quotes bug low triaged

Version 0.2.6 contains features such as:

Version 0.2.5 contains features such as:

For more information see CHANGELOG.md

How does it looks like?

Check how does it look in an execution at: asciicast

Collaborate

Usage

$ memsource --help
usage: memsource [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug] [--ms-username <auth-username>] [--ms-password <auth-password>] [--ms-token <auth-token>]

Unofficial Memsource CLI client

optional arguments:
  --version             show program's version number and exit
  -v, --verbose         Increase verbosity of output. Can be repeated.
  -q, --quiet           Suppress output except warnings and errors.
  --log-file LOG_FILE   Specify a file to log output. Disabled by default.
  -h, --help            Show help message and exit.
  --debug               Show tracebacks on errors.
  --ms-username <auth-username>
                        Authentication username (Env: MEMSOURCE_USERNAME)
  --ms-password <auth-password>
                        Authentication password (Env: MEMSOURCE_PASSWORD)
  --ms-token <auth-token>
                        Authentication token (Env: MEMSOURCE_TOKEN)

Commands:
  analyse create  Create analysis
  analyse delete  Delete analysis
  analyse language create  Create analyses by languages
  analyse project list  List analyses by project
  analyse show   Get Analysis
  auth login     Login
  auth whoami    Who am I
  complete       print bash completion command (cliff)
  help           print detailed help for another command (cliff)
  job create     Creates job in project
  job delete     Delete jobs
  job download   Download job file
  job list       List jobs in project
  job show       Get job
  job translations delete  Delete translations
  project create  Create new project
  project delete  Deletes a project
  project list   List projects
  project show   Get project
  project template create  Create new project from template
  translation pre-translate  Pre-translate job
  user create    Create user
  user get       Get user

Getting Started

Requirements for python2 environments:

  • package python-virtualenv

Install from PyPI

DIRECTORY="${HOME}/git/memsource-cli-client/"
if [[ ! -d ${DIRECTORY} ]]; then
  mkdir -p ${DIRECTORY}
fi
cd $DIRECTORY

if [[ -f $(which python3) ]];
then
  python3 -m venv --system-site-packages .memsource
else
  if [[ ! -f $(which virtualenv) ]];
  then
    sudo yum -y install python-virtualenv
  fi
  virtualenv --system-site-packages .memsource
fi

source .memsource/bin/activate
pip install -U pip
pip install -U setuptools
pip install memsource-cli

clear
memsource --help

Install from Github

DIRECTORY="$HOME/git/"

if [[ ! -d ${DIRECTORY} ]]; then
  mkdir ${DIRECTORY}
fi
cd ${DIRECTORY}
if [[ ! -d ${DIRECTORY}/memsource-cli-client ]]; then
  git clone https://github.com/unofficial-memsource/memsource-cli-client.git
  cd memsource-cli-client/
  if [[ -f $(which python3) ]];
  then
    python3 -m venv --system-site-packages .memsource
  else
    if [[ ! -f $(which virtualenv) ]];
    then
      sudo yum -y install python-virtualenv
    fi
    virtualenv --system-site-packages .memsource
    for py in $(find memsource_cli -name "*.py"); do sed -i -e 's#/usr/bin/env python3#/usr/bin/env python#' $py; done
  fi
  source .memsource/bin/activate
  pip install -U pip
  pip install -U setuptools
  pip install -e .
  deactivate
else
  cd memsource-cli-client/
  rm -Rf .memsource
  if [[ -f $(which python3) ]];
  then
    python3 -m venv --system-site-packages .memsource
  else
    if [[ ! -f $(which virtualenv) ]];
    then
      sudo yum -y install python-virtualenv
    fi
    virtualenv --system-site-packages .memsource
    for py in $(find memsource_cli -name "*.py"); do sed -i -e 's#/usr/bin/env python3#/usr/bin/env python#' $py; done
  fi
  source .memsource/bin/activate
  git checkout master
  git reset --hard
  git pull
  if [[ ! -f $(which python3) ]];
  then
    for py in $(find memsource_cli -name "*.py"); do sed -i -e 's#/usr/bin/env python3#/usr/bin/env python#' $py; done
  fi
  source .memsource/bin/activate
  pip install -e .
  deactivate
fi
source ${DIRECTORY}/memsource-cli-client/.memsource/bin/activate
clear
memsource --help

And that's it!

Configuration

This way you can configure your username/password and set up memsource token for faster authentication:

source ${HOME}/git/memsource-cli-client/.memsource/bin/activate
export MEMSOURCE_USERNAME=<username>
export MEMSOURCE_PASSWORD=<password>
export MEMSOURCE_TOKEN=$(memsource auth login --user-name $MEMSOURCE_USERNAME --password "${MEMSOURCE_PASSWORD}" -c token -f value)

Or you can create a file:

Edit file with vi ~/.memsourcerc and paste following content:

source ${HOME}/git/memsource-cli-client/.memsource/bin/activate
export MEMSOURCE_USERNAME=<username>
export MEMSOURCE_PASSWORD=<password>
export MEMSOURCE_TOKEN=$(memsource auth login --user-name $MEMSOURCE_USERNAME --password "${MEMSOURCE_PASSWORD}" -c token -f value)

Then only source that file to start using memsource-cli:

source ~/.memsourcerc

Requirements:

  • jq

Autocompletion

To add autocompletion to your shell so you can type:

mem[tab] pr[tab] cr[tab] which will translate to:

memsource project create

memsource complete | sudo tee /etc/bash_completion.d/memsource > /dev/null
. /etc/bash_completion.d/memsource

Now you should be fine to use memsource

Contact us!

This project is maintained on Github.

You can’t perform that action at this time.