|
| 1 | +#!/usr/bin/env node |
| 2 | +'use strict'; |
| 3 | + |
| 4 | +var fs = require('fs'); |
| 5 | +var nuxeo = require('nuxeo'); |
| 6 | + |
| 7 | +var ArgumentParser = require('argparse').ArgumentParser; |
| 8 | +var parser = new ArgumentParser({ |
| 9 | + version: '0.0.1', |
| 10 | + addHelp: true, |
| 11 | + description: 'nuxeo command line helper', |
| 12 | +}); |
| 13 | + |
| 14 | +var subparsers = parser.addSubparsers({ |
| 15 | + title:'subcommands', |
| 16 | + dest:"subcommand_name" |
| 17 | +}); |
| 18 | + |
| 19 | +var cp = subparsers.addParser('cp', {addHelp: true}); |
| 20 | +cp.addArgument( |
| 21 | + [ '-R', '-r', '--recursive' ], |
| 22 | + { |
| 23 | + action: 'storeTrue', |
| 24 | + help: 'copy directories recursively' |
| 25 | + } |
| 26 | +); |
| 27 | +cp.addArgument( [ 'source_file' ], { nargs: '+' }); |
| 28 | +cp.addArgument( [ 'dest_file' ], { nargs: '1' }); |
| 29 | + |
| 30 | +var args = parser.parseArgs(); |
| 31 | +console.dir(args); |
| 32 | + |
| 33 | +/* Copyright © 2015, Regents of the University of California |
| 34 | +
|
| 35 | +All rights reserved. |
| 36 | +
|
| 37 | +Redistribution and use in source and binary forms, with or without |
| 38 | +modification, are permitted provided that the following conditions |
| 39 | +are met: |
| 40 | +
|
| 41 | + * Redistributions of source code must retain the above copyright |
| 42 | + notice, this list of conditions and the following disclaimer. |
| 43 | + * Redistributions in binary form must reproduce the above copyright |
| 44 | + notice, this list of conditions and the following disclaimer in |
| 45 | + the documentation and/or other materials provided with the |
| 46 | + distribution. |
| 47 | + * Neither the name of the University of California nor the names |
| 48 | + of its contributors may be used to endorse or promote products |
| 49 | + derived from this software without specific prior written |
| 50 | + permission. |
| 51 | +
|
| 52 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 53 | +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 54 | +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 55 | +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 56 | +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 57 | +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 58 | +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 59 | +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 60 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 61 | +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 62 | +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 63 | +POSSIBILITY OF SUCH DAMAGE. |
| 64 | +
|
| 65 | +*/ |
0 commit comments