Skip to content

Commit

Permalink
Rename profile argument -p -> -P. Fixes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
eliihen committed Aug 12, 2016
1 parent 8e803a8 commit 8d5a9c3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ urls and headers saved to a file for easy reuse at a later point.

If you have web services in different environments, you might for example want
to have a `foo-dev` and `foo-prod` configuration file. This makes it easy to at
a later date connect to `foo` by simply running `wsta -p foo-dev`,
a later date connect to `foo` by simply running `wsta -P foo-dev`,

These files could be checked into VCS and shared between colleagues.

Expand Down
8 changes: 3 additions & 5 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ use std::env;
/// invoked (to init options).
/// This method is not perfect - it would be hard to support
/// both `--profile test` and `--profile=test`, for example, so
/// we keep it simple and only support -p
/// we keep it simple and only support -P
pub fn get_profile() -> Option<String> {

// Find the position of -p
let pos = env::args().position(|a| {
a == "-p"
});
// Find the position of -P
let pos = env::args().position(|a| a == "-P");

// Get the next arg as the value
if pos.is_some() {
Expand Down
4 changes: 2 additions & 2 deletions src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub fn get_vec(config: &Config, key: &str) -> Vec<String> {
/// Determine the conf file location using the special %APPDATA% directory of
/// windows.
///
/// Supports profiles, i.e. `-p someapp` resolves to
/// Supports profiles, i.e. `-P someapp` resolves to
/// %APPDATA%/wsta/someapp/wsta.conf
#[cfg(windows)]
fn get_config_path(profile: Option<String>) -> Option<PathBuf> {
Expand All @@ -125,7 +125,7 @@ fn get_config_path(profile: Option<String>) -> Option<PathBuf> {
/// Determine the conf file location using the XDG basedir spec, which defaults
/// to $HOME/.config/wsta/wsta.conf
///
/// Supports profiles, i.e. `-p someapp` resolves to
/// Supports profiles, i.e. `-P someapp` resolves to
/// XDG_CONF_DIR/wsta/someapp/wsta.conf
#[cfg(unix)]
fn get_config_path(profile: Option<String>) -> Option<PathBuf> {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn main() {
// before ArgumentParser is invoked
ap.refer(&mut dummy)
.metavar("NAME")
.add_option(&["-p"], Store,
.add_option(&["-P"], Store,
"use a different configuration profile");

ap.refer(&mut options.verbosity)
Expand Down
6 changes: 3 additions & 3 deletions wsta.1
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ will honour any redirects the server requests.
config key: follow_redirect (Boolean)

.TP
.B \-p NAME
.B \-P NAME
Tell
.B wsta
to use a configuration profile for this connection only. The name of the profile
Expand All @@ -154,7 +154,7 @@ is the name of the folder in
where the file that is to be loaded is located.

If you want a profile to be used without
.B \-p,
.B \-P,
use the file
.I $XDG_CONFIG_HOME/wsta/wsta.conf.

Expand Down Expand Up @@ -256,7 +256,7 @@ Any profiles are simply fonders inside the
config directory. Any files names
.B wsta.conf
placed in the config directory can later be loaded using
.B \-p <profile_name>.
.B \-P <profile_name>.


.SH AUTHOR
Expand Down
6 changes: 3 additions & 3 deletions wsta.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ wsta(1) General Commands Manual wsta(1)
config key: follow_redirect (Boolean)


-p NAME
-P NAME
Tell wsta to use a configuration profile for this connection
only. The name of the profile is the name of the folder in
$XDG_CONFIG_HOME/wsta where the file that is to be loaded is
located.

If you want a profile to be used without -p, use the file
If you want a profile to be used without -P, use the file
$XDG_CONFIG_HOME/wsta/wsta.conf.

Also see the FILES section.
Expand Down Expand Up @@ -206,7 +206,7 @@ wsta(1) General Commands Manual wsta(1)
$XDG_CONFIG_HOME/wsta/<profile_name>/wsta.conf
Any profiles are simply fonders inside the wsta config direc-
tory. Any files names wsta.conf placed in the config directory
can later be loaded using -p <profile_name>.
can later be loaded using -P <profile_name>.



Expand Down

0 comments on commit 8d5a9c3

Please sign in to comment.