Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit d43a94f

Browse files
committed
add project clear method
1 parent d404dfd commit d43a94f

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

lib/project/clear.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
'use strict';
2+
3+
var projectConfig = require('./../projectConfig');
4+
5+
/**
6+
* @memberof project
7+
* @method clear
8+
* @description Clear the project configuration settings. Only the project name will remain in the config file.
9+
* @param {function} cb - Node-style error-first callback function
10+
* @returns {object} project config
11+
* @example
12+
* paperspace.project.clear(function(err, resp) {
13+
* // handle error or http response
14+
* });
15+
* @example
16+
* $ paperspace project clear
17+
* @example
18+
* # Note: there is no HTTP request corresponding to 'paperspace project clear'.
19+
* @example
20+
* // Example return value:
21+
* {
22+
* "project": "myproject",
23+
* }
24+
*/
25+
26+
function clear(params, cb) {
27+
projectConfig.clear();
28+
var config = projectConfig.show();
29+
return cb(null, config);
30+
}
31+
32+
module.exports = clear;

lib/project/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
module.exports = {
8+
clear: require('./clear'),
89
init: require('./init'),
910
show: require('./show'),
1011
};

lib/projectConfig.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ function write() {
2727
}
2828
}
2929

30+
function clear() {
31+
read();
32+
var project = config.project;
33+
config = { project: project };
34+
write();
35+
}
36+
3037
function getProject() {
3138
read();
3239
return config.project;
@@ -183,5 +190,6 @@ module.exports = {
183190
setWorkspace: setWorkspace,
184191
getName: getName,
185192
setName: setName,
193+
clear: clear,
186194
show: show,
187195
};

0 commit comments

Comments
 (0)