0.2.0 • Published 5 years ago
gitlab-snippet-sync v0.2.0
gitlab-snippet-sync
Downloads snippets from a GitLab server to a local directory.
Usage: gitlab-snippet-sync [options]
Options:
-V, --version output the version number
-s, --server <server> origin of the GitLab server
-t, --token <token> (API) access token for reading the snippets
-n, --token-variable <name> environment variable with the access token
-d, --directory <directory> work in a specific directory
-q, --quiet suppress logging on the console
-v, --verbose log more progress on the console
-h, --help output usage information
Snippets will be downloaded to the directory "snippets". It will be
created in the directory where this script is executed by default.
The default server is "https://gitlab.com". The default environment
variable with the access token is "GITLAB_TOKEN".
Examples:
$ GITLAB_TOKEN="..." gitlab-snippet-sync
$ glsnipsync -s https://gitlab.my.com -t "..."
Installation
This module can be installed globally using NPM or Yarn, so that the command-line script can be executed in any directory. Make sure, that you use Node.js version 10 or newer.
$ npm i -g gitlab-snippet-sync
$ yarn add global gitlab-snippet-sync
API
The module can be installed in a local project instead of globally. The functionality can be called programmatically and without the console output:
const { downloadSnippets } = require('gitlab-snippet-sync')
await downloadSnippets({
server: 'https://gitlab.com',
token: process.env.GITLAB_TOKEN,
directory: '.',
quiet: true,
verbose: false
})
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
- 2019-10-01 v0.1.2 Download only modified scripts
- 2019-09-30 v0.0.1 Initial release
License
Copyright (c) 2019 Ferdinand Prantl
Licensed under the MIT license.