Skip to content

Commit

Permalink
Update docs for set-default-session, and suggest --session argument u…
Browse files Browse the repository at this point in the history
…sage (#4447)
  • Loading branch information
cmdcolin authored Jun 17, 2024
1 parent b0948c4 commit 053b01f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
15 changes: 12 additions & 3 deletions products/jbrowse-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ FLAGS
-c, --currentSession List out the current default session
-h, --help Show CLI help.
-n, --name=<value> [default: New Default Session] Give a name for the default session
-s, --session=<value> set path to a file containing session in json format
-s, --session=<value> set path to a file containing session in json format (required, unless using
delete/currentSession flags)
--delete Delete any existing default session.
--out=<value> synonym for target
--target=<value> path to config file in JB2 installation directory to write out to
Expand All @@ -558,11 +559,19 @@ DESCRIPTION
Set a default session with views and tracks
EXAMPLES
# set default session for the config.json in your current directory
$ jbrowse set-default-session --session /path/to/default/session.json
$ jbrowse set-default-session --target /path/to/jb2/installation/config.json
$ jbrowse set-default-session --view LinearGenomeView, --name newName
# make session.json the defaultSession on the specified target config.json file
$ jbrowse set-default-session --target /path/to/jb2/installation/config.json --session session.json
# print current default session
$ jbrowse set-default-session --currentSession # Prints out current default session
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ exports[`fails when file does not exist 1`] = `"Could not read the provided file

exports[`fails when file is does not have a default session to read 1`] = `"Could not parse the given default session file"`;

exports[`fails when no necessary default session information is provided 1`] = `"Please either provide a default session file"`;
exports[`fails when no necessary default session information is provided 1`] = `"Please provide a --session file"`;
13 changes: 9 additions & 4 deletions products/jbrowse-cli/src/commands/set-default-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@ export default class SetDefaultSession extends JBrowseCommand {
static description = 'Set a default session with views and tracks'

static examples = [
'# set default session for the config.json in your current directory',
'$ jbrowse set-default-session --session /path/to/default/session.json',
'$ jbrowse set-default-session --target /path/to/jb2/installation/config.json',
'$ jbrowse set-default-session --view LinearGenomeView, --name newName',
'',
'# make session.json the defaultSession on the specified target config.json file',
'$ jbrowse set-default-session --target /path/to/jb2/installation/config.json --session session.json',
'',
'# print current default session',
'$ jbrowse set-default-session --currentSession # Prints out current default session',
]

static flags = {
session: Flags.string({
char: 's',
description: 'set path to a file containing session in json format',
description:
'set path to a file containing session in json format (required, unless using delete/currentSession flags)',
}),
name: Flags.string({
char: 'n',
Expand Down Expand Up @@ -78,7 +83,7 @@ export default class SetDefaultSession extends JBrowseCommand {
)
this.exit()
} else if (!session) {
this.error(`Please either provide a default session file`, { exit: 120 })
this.error(`Please provide a --session file`, { exit: 120 })
} else if (session) {
await this.writeJsonFile(this.target, {
...configContents,
Expand Down

0 comments on commit 053b01f

Please sign in to comment.