Skip to content

Commit 4bd4d92

Browse files
author
Kevin Yan
authored
Merge pull request #104 from plotly/save_config_sharing
add sharing parameter for saveplotlyconfig
2 parents 4ddb8c3 + be2d5c8 commit 4bd4d92

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

plotly/plotly_user_aux/loadplotlyconfig.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
['It looks like you haven''t set up your plotly '...
1111
'account configuration file yet.\nTo get started, save your '...
1212
'plotly/stream endpoint domain by calling:\n'...
13-
'>>> saveplotlycredentials(plotly_domain, plotly_streaming_domain)\n\n'...
13+
'>>> saveplotlyconfig(plotly_domain, plotly_streaming_domain)\n\n'...
1414
'For more help, see https://plot.ly/MATLAB or contact '...
1515
1616
end

plotly/plotly_user_aux/saveplotlyconfig.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function saveplotlyconfig(plotly_domain,plotly_streaming_domain)
1+
function saveplotlyconfig(plotly_domain,plotly_streaming_domain,sharing)
22
% Save plotly config info.
33
% Plotly config info are saved as JSON strings
44
% in ~/.plotly/.config
@@ -8,7 +8,7 @@ function saveplotlyconfig(plotly_domain,plotly_streaming_domain)
88
error('plotly:saveconfig', ...
99
['Incorrect number of inputs. Please save your configuration ', ...
1010
'as follows: >> saveplotlyconfig(plotly_domain,', ...
11-
'[optional]plotly_streaming_domain)']);
11+
'[optional]plotly_streaming_domain,', '[optional]sharing)']);
1212
end
1313

1414
% if the config file exists, then load it up
@@ -56,6 +56,17 @@ function saveplotlyconfig(plotly_domain,plotly_streaming_domain)
5656
config.plotly_domain = plotly_domain;
5757
signin(username, api_key, plotly_domain);
5858
config.plotly_streaming_domain= plotly_streaming_domain;
59+
case 3
60+
config.plotly_domain = plotly_domain;
61+
signin(username, api_key, plotly_domain);
62+
config.plotly_streaming_domain = plotly_streaming_domain;
63+
sharing = lower(sharing);
64+
if(strcmp(sharing, 'public') | strcmp(sharing, 'private'))
65+
config.sharing = sharing;
66+
else
67+
warning(['"%s" is an invalid/un-supported value of sharing.\n', ...
68+
'Please use one of "public" or "private"'], sharing);
69+
end
5970
otherwise %if neither endpoints are specified, no worries!
6071
end
6172

0 commit comments

Comments
 (0)