sida_b 4 år sedan
incheckning
880aaded3c
5 ändrade filer med 86 tillägg och 0 borttagningar
  1. 1
    0
      .gitignore
  2. 12
    0
      blih-repository
  3. 15
    0
      blih-repository-list
  4. 40
    0
      blih.js
  5. 18
    0
      package.json

+ 1
- 0
.gitignore Visa fil

1
+node_modules/

+ 12
- 0
blih-repository Visa fil

1
+#!/usr/bin/env node
2
+'use strict';
3
+
4
+var program = require('commander');
5
+
6
+program
7
+.command('create <repo>', 'Create a new repository named "repo"')
8
+.command('list', 'List the repositories created')
9
+.command('info <repo>', 'Get the repository metadata')
10
+.command('getacl <repo>', 'Get the acls set for the repository')
11
+.command('setacl <repo> <user> [acl]', 'Set (or remove) an acl for "user" on "repo"')
12
+.parse(process.argv);

+ 15
- 0
blih-repository-list Visa fil

1
+#!/usr/bin/env node
2
+'use strict';
3
+
4
+var program = require('commander');
5
+
6
+program
7
+.version('1.7')
8
+.option('-v, --verbose', 'Enable verbose mode', false)
9
+.option('-u, --user <user>', 'Set user', undefined)
10
+.option('-b, --baseurl <url>', 'Set baseurl', 'https://blih.epitech.eu/')
11
+.option('-t, --token <token>', 'Set token', undefined)
12
+.option('-U, --useragent <agent>', 'Set useragent', 'blih-' + program.version)
13
+.parse(process.argv);
14
+
15
+console.log(program);

+ 40
- 0
blih.js Visa fil

1
+#!/usr/bin/env node
2
+'use strict';
3
+
4
+const program = require('commander');
5
+
6
+program
7
+.version('1.7')
8
+.option('-v, --verbose', 'Enable verbose mode', false)
9
+.option('-u, --user <user>', 'Set user', undefined)
10
+.option('-b, --baseurl <url>', 'Set baseurl', 'https://blih.epitech.eu/')
11
+.option('-t, --token <token>', 'Set token', undefined)
12
+.option('-U, --useragent <agent>', 'Set useragent', 'blih-' + program.version);
13
+
14
+program
15
+.command('repository [params...]')
16
+.description('Manages repositories')
17
+.action(function (params) {
18
+	const repository = require('commander');
19
+	console.log(process.argv);
20
+	repository
21
+	.version('1.7')
22
+	.command('list')
23
+	.description('List the repositories created')
24
+	.action(function () {
25
+		console.log('list');
26
+	});
27
+	repository.parse(params);
28
+});
29
+
30
+program
31
+.command('sshkey')
32
+.description('Manages SSH keys')
33
+.action();
34
+
35
+program
36
+.command('whoami')
37
+.description('Ask who you are')
38
+.action();
39
+
40
+program.parse(process.argv);

+ 18
- 0
package.json Visa fil

1
+{
2
+  "name": "glih",
3
+  "version": "1.0.0",
4
+  "description": "javascript version of epitech's blih utility",
5
+  "main": "blih.js",
6
+  "scripts": {
7
+    "test": "echo \"Error: no test specified\" && exit 1"
8
+  },
9
+  "bin": {
10
+    "glih": "blih.js"
11
+  },
12
+  "repository": {
13
+    "type": "git",
14
+    "url": "ssh://git@git.coldiary.eu:10022/coldiary/Glih.git"
15
+  },
16
+  "author": "sida_b",
17
+  "license": "ISC"
18
+}