Table of contents
- Introduction
- Releases
- Highlights
- What's new
- How does it looks like?
- Collaborate
- Usage
- Getting Started
- Install from PyPI (Red Hat Enterprise Linux derivatives)
- Install from PyPI (Windows)
- Install from Github (Red Hat Enterprise Linux derivatives)
- Install from Github (Older Fedora with Python2)
- Configuration (Red Hat Enterprise Linux derivatives)
- Configuration (Windows)
- Contact us!
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.
- For the latest and greatest bits, please follow guide Install from Github
- For latest released version, please follow guide Install from PyPI
- 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
Version 0.3.8
Fixed #25 and #26 [FEATURE] Added metadata such as total_pages
and others into job list output
Version 0.3.7
Added new feature such as
Version 0.3.6
Added new feature such as
Version 0.3.4
Added new features such as
- Download Translation Memory
- Export Translation Memory
- Import segments
- List Translation Memories
- Wildcard Search Translation Memory
- Edit jobs
Version 0.3.3
Fixed #20 [BUG] memsource job create --debug displays empty output
Fixed #23 [BUG] memsource job download didn't display help
Version 0.3.2
[0.3.2] Fixed user.py syntax error for python2
Version 0.3.1
Fixed #19 [BUG] List users
Fixed #12 [BUG] Assign jobs to poviders
Fixed #15 [BUG] 'charmap' error on bilingual download
[0.3.1] Add new command 'memsource use list'
[0.3.1] Add new command 'memsource job edit'
[0.3.1] memsource job download can work on multiple job_uids
[0.3.1] force directory creation with --output-dir on job download
[0.3.1] Add Memsource custom base url
Added new features such as
- Job edit
- User list
- Job file download (multiple job_uids)
- Job file download (all job_uids within project)
Option to use custom URL:
--ms-auth-url <auth-url>
Authentication URL (Env: MEMSOURCE_URL)
or add to your memsourcerc
file:
export MEMSOURCE_URL="https://cloud.memsource.com/web"
Version 0.3
[0.3] Adding feature project template list
[0.3] Move memsource project template create
to project create --template-id
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:
- Job file download (bilingual MXLF)
- Job file download (bilingual XLIFF)
- Job file download (bilingual DOCX)
- Job file download (target)
- Job file download (original)
Version 0.2.5 contains features such as:
- Create analysis
- Delete analysis
- Create analyses by languages
- List analyses by project
- Get Analysis
- Login
- Who Am I
- Creates job in project
- Delete job
- List jobs in project
- Get job
- Create new project
- Deletes a project
- List projects
- Get project
- Create new project from template
- Create user
- Get user
For more information see CHANGELOG.md
Check how does it look in an execution at:
- Open issues/feature requests, etc at https://github.com/unofficial-memsource/memsource-cli-client/issues
$ 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>]
[--ms-auth-url <auth-url>]
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)
--ms-auth-url <auth-url>
Authentication URL (Env: MEMSOURCE_URL)
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 edit Edit job
job list List jobs in project
job show Get job
job translations delete Delete translations
jobs edit Edit jobs
project assign providers Assigns providers from template
project create Create new project
project delete Deletes a project
project list List projects
project show Get project
template list List templates
template show Show template
translation memory download Download Translation Memory
translation memory export Export Translation Memory
translation memory import Import segments
translation memory list List Translation Memories
translation memory search Wildcard Search Translation Memory
translation pre-translate Pre-translate job
user create Create user
user get Get user
user list List users
Requirements for python2 environments:
- package
python-virtualenv
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
- Download the executable for Python 3.7.0 from here
- Run the executable
- Make sure you select the Install launcher for all users and Add Python 3.7 to PATH checkboxes.
- Make sure to Disable path length limit.
- Open up a terminal Command Prompt
- Type
python --version
You should see:
C:\Users\Robin>python --version
Python 3.7.0
- Run following to create virtual environment and install memsource-cli
md %systemdrive%%homepath%\VirtualEnvironments
cd %systemdrive%%homepath%\VirtualEnvironments
python -m venv memsource
.\memsource\Scripts\activate
%systemdrive%%homepath%\VirtualEnvironments\memsource\scripts\python.exe -m pip install --upgrade pip setuptools
%systemdrive%%homepath%\VirtualEnvironments\memsource\scripts\python.exe -m pip install memsource-cli
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!
First you need to force install with Python 2
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 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
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 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
source .memsource/bin/activate
git checkout master
git reset --hard
git pull
for py in $(find memsource_cli -name "*.py"); do sed -i -e 's#/usr/bin/env python3#/usr/bin/env python#' $py; done
source .memsource/bin/activate
pip install -e .
deactivate
fi
source ${DIRECTORY}/memsource-cli-client/.memsource/bin/activate
memsource --help
You may get the following error:
ERROR: Package 'setuptools' requires a different Python: 2.7.13 not in '>=3.5'
You need to downgrade setuptools in order to make it working with Python2:
pip install --upgrade 'setuptools<45.0.0'
And that's it!
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_URL="https://cloud.memsource.com/web"
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_URL="https://cloud.memsource.com/web"
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
sudo yum -y install jq
Now you can create a memsourcerc.bat
script with following to start using your memsource-cli
@echo off
SET MEMSOURCE_URL=https://cloud.memsource.com/web
SET MEMSOURCE_USERNAME="username"
SET MEMSOURCE_PASSWORD="password"
cd %systemdrive%%homepath%\VirtualEnvironments
.\memsource\Scripts\activate && memsource auth login --user-name %MEMSOURCE_USERNAME% --password %MEMSOURCE_PASSWORD% -c token -f value >> tmp.txt && SET /p MEMSOURCE_TOKEN=<tmp.txt && DEL tmp.txt
Then only call that file to start using memsource-cli:
.\memsourcerc.bat
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
This project is maintained on Github.
- Please contact us by submitting issue
- Feel free to join our Unofficial Memsource CLI Telegram Group
- Check out our wiki !