18/11/2017
sdk/READ M E.md at master · meg anz/sdk · Gi tHub
meganz / meganz / sdk sdk
master mast er
sdk / sdk / examples examples / / megacmd megacmd / / README.md
Find fil file e
polmr improved polmr improved changelog scripts
Copy Cop y pat path h
f6b3c49 on 28 Aug
1 contributor
200 lines (149 sloc)
7.84 KB
MEGAcmd - Command Line Interactive and a nd Scriptable Application MEGAcmd provides non UI access to MEGA services. It intends to offer all the functionality with your MEGA account via commands. Available packages for MEGAcmd in all supported platforms should be found here here.. It supports 2 modes of interaction: interactive. A shell to query your actions scriptable. A way to execute commands from a shell/a script/another program. In order to provide those 2 modes, it features one server ( MEGAcmdServer MEGAcmdServer), ), an interactive shell ( MEGAcmdShell MEGAcmdShell)) and several commands that will launch the non-interactive client ( MEGAcmdClient MEGAcmdClient). ). See Usage and Platform to understand how to use it in your particular sys tem.
Building MEGAcmd If you wish to build MEGAcmd using this repository, here are a list of requirements and building instructions.
Requirements The same as those for the sdk ( cryptopp, zlib, sqlite3, cares, libuv, ssl, Also, it is recommended to include pcre to have support for regular expressions. For convenience here is a list of packages for ubuntu 16.04:
curl, sodium
) and of course
readline
.
autoconf libtool g++ libcrypto++-dev libz-dev sqlite3-
dev libsqlite3-dev libssl-dev libcurl4-openssl-dev libreadline-dev libpcre++-dev libsodium-dev
Building and installing For platforms with Autotools, MEGAcmd is included in the generic compilation of the sdk. To build and install: sh autogen.sh ./configure make make install
You will need to run
make install
To disable MEGAcmd use
as root
configure
with
--disable-megacmd
: if you use a prefix in configure, autocompletion from non-interactive usage won't work. You would need to /YOUR/PREFIX/etc/bash_completion.d/megacmd_completion.sh (or link it at /etc/bash_completion.d) Note
source
Usage
https://g i thub.com/meg anz/sdk/bl ob/master /exampl es/meg acmd/READM E.md
1/4
18/11/2017
sdk/READ M E.md at master · meg anz/sdk · Gi tHub
Before explaining the two ways of interaction, it is important to understand how MEGAcmd works. When you login with MEGAcmd, your session, the list of synced folders, and some cache database are stored in your local home folder. MEGAcmd also stores some other configuration in that folder. Closing it does not delete those and restarting your computer will restore your previous session (the same as megasync won't ask for user/password once you restart your computer). You will need to logout properly in order to clean your data. Now let's get into details of the two usage modes. Both modes require that MEGAcmdServer is running. You can manually launch it. Fortunately, you can also open the interactive shell or execute any command and the server will start automatically.
Interactively: Execute MEGAcmd shell.
Platform
section explains how to do that in the differ ent supported systems. systems . You should be facing an
interactive shell where you can start typing your commands, with their arguments and flags. You can list all the available commands with help . And obtain useful information infor mation about a command with command --help Primero, desea iniciar sesión en su cuenta. De nuevo: observe que al hacer esto, almacena la sesión y otras cosas en su carpeta de inicio. Se requiere un cierre de sesión completo si desea terminar su sesión de forma permanente y limpiar cualquier rastro (consulte
logout --help
para obtener más información).
No interac interactivamente: tivamente: Cuando el servidor MEGAcmd se está ejecutando, escuchará los comandos del cliente. Usa los diferentes
mega-*
comandos
disponibles. mega-help listará todos estos comandos (deberá anteponer "mega-" a los comandos allí enumerados). Para obtener más información, use mega-command --help Esos comandos tendrán un valor de salida! = 0 en caso de falla. Consulte megacmd.h megacmd.h para para ver los códigos de error existentes. Idealmente, le gustaría tener estos comandos en su RUTA (Consulte información, use
mega-help --non-interactive
Platform
para obtener más información). Para más
.
Plataformas Linux Si ha instalado MEGAcmd usando uno de los paquetes disponibles aquí aquí , , o lo ha construido sin él
--prefix
, tanto el servidor (
), el shell ( mega-cmd ) y los diferentes comandos del cliente ( mega-* ) estarán en su RUTA (en una instalación nueva, es posible que necesita abrir su terminal nuevamente). Si está utilizando bash, también debe tener mega-cmd-server
autocompletado para que los comandos del cliente autocompletado cli ente funcionen. Si ese no es tu caso, incluy e la ubicación de los binarios binar ios en tu camino.
Windows Una vez que haya instalado MEGAcmd, solo necesita ejecutar el ejecutable principal para abrir el shell. Esto abrirá una segunda ventana con MEGAcmdServer. Tenga en cuenta que esta ventana comenzará a minimizarse. Para una mejor experiencia de usuario (especialmente en WINDOWS 7), recomendamos ejecutar MEGAcmd desde PowerShell: Open PowerShell y ejecutar: $env:PATH += ";$env:LOCALAPPDATA\MEGAcmd" MEGAcmdShell
Para el uso no interactivo, hay varios
mega-*.bat
comandos de cliente que puede usar para escribir sus rutas absolutas, o
incluir su ubicación en su PATH de entorno y ejecutarlas normalmente ( oficial, puede hacerlo simplemente con:
mega-*
). Si usa PowerShell y ha instalado el MEGAcmd
$env:PATH += ";$env:LOCALAPPDATA\MEGAcmd"
La finalización de los comandos del cliente requiere bash, por lo tanto, no está disponible para Windows.
Advertencias
https://g i thub.com/meg anz/sdk/bl ob/master /exampl es/meg acmd/READM E.md
2/4
18/11/2017
sdk/READ M E.md at master · meg anz/sdk · Gi tHub
Aunque ha habido varios esfuerzos para tener caracteres Unicode no ASCII compatibles con Windows, aún puede haber algunos problemas. Preste especial atención si está dispuesto a usar tuberías o envía la salida de un comando a un archivo desde los comandos de su cliente. Consulte help --unicode para obtener más información al respecto.
Mac OS Para MacOS, después de instalar dmg, puede iniciar el servidor usando MEGAcmd en Aplicaciones. Si desea utilizar los comandos del cliente desde la Terminal de MacOS, abra la Terminal e incluya la carpeta de instalación en la RUTA. Típicamente: export PATH=/Applications/MEGAcmd.app/Contents/MacOS:$PATH
Y para completar bash, fuente
megacmd_completion.sh
:
source /Applications/MEGAcmd.app/Contents/MacOS/megacmd_completion.sh
caracteristicas: Autocompletado: MEGAcmd presenta autocompletado en modo interactivo y no interactivo (solo para bash). Ayudará a completar archivos locales y remotos (Mega Cloud), indicadores para comandos, valores para banderas / niveles de acceso, incluso contactos.
Verbosidad Hay dos tipos diferentes de mensajes de registro: Basado en SDK: los mensajes informados por el SDK y las bibliotecas dependientes. Basado en MEGAcmd: esos mensajes informados por MEGAcmd. Puede ajustar el nivel de registro para esos tipos con log comando. Sin embargo, para los comandos no interactivos, pasando -v ( -vv , -vvv y así sucesivamente para una salida con más información) utilizará un mayor nivel de verbosidad a un comando específico.
Expresiones Expresio nes regulares re gulares Si ha compilado MEGAcmd con PCRE (habilitado por defecto), puede usar expresiones compatibles con PCRE en ciertos comandos con la bandera --use-pcre . De lo contrario, si se compila con c ++ 11, se usarán las expresiones regulares c ++ 11. Si no es el caso anterior, solo puede usar comodines: "*" para cualquier número de caracteres o "?" para un solo personaje desconocido. Puede verificar la compatibilidad de expresiones regulares con find --help ... Options: --pattern=PATTERN
find --help
. p.ej:
Pattern to match (Perl Compatible Regular Expressions)
Notice: if you use MEGAcmd in non interactive mode, notice that shell pattern will take precedence. You will need to either escape symbols like * ( \* ) or surr s urround ound them between quotes quotes (e.g: "*.txt")
Known Bugs Currently there are certain discrepancies with PATHS when loggin into a public folder. For instance, imagine a folder named toshare with a subfolder named x . If we login into toshare and execute find /x , this will wi ll be the output: /toshare/x
Whereas if we execute
find /toshare/x
, we receive an error, since folder absolute path refers to
https://g i thub.com/meg anz/sdk/bl ob/master /exampl es/meg acmd/READM E.md
/
as root path.
3/4
18/11/2017
sdk/READ M E.md at master · meg anz/sdk · Gi tHub [err: 12:21:51] Couldn't find /toshare/x
It might better be referred as /toshare/x
https://g i thub.com/meg anz/sdk/bl ob/master /exampl es/meg acmd/READM E.md
4/4