-
Notifications
You must be signed in to change notification settings - Fork 0
/
repositories.js
33 lines (30 loc) · 878 Bytes
/
repositories.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const Configuration = require('./configuration');
let config = new Configuration();
function add_repository(repo_name, repo_location, repo_password, remote_user, remote_password) {
config.repositories.push({
name: repo_name,
location: repo_location,
password: repo_password,
remote_user: remote_user ? remote_user : null,
remote_password: remote_password ? remote_password : null,
});
config.save();
}
function remove_repository(repo_name) {
for (id in config.repositories) {
if (repo_name == config.repositories[id].name) {
config.repositories.splice(id, 1);
config.save();
return true;
}
}
return false;
}
function list_repositories() {
return config.repositories;
}
module.exports = {
add_repository,
remove_repository,
list_repositories
};