diff --git a/products/jbrowse-cli/README.md b/products/jbrowse-cli/README.md index 12b9431db1..de5d87a159 100644 --- a/products/jbrowse-cli/README.md +++ b/products/jbrowse-cli/README.md @@ -549,7 +549,8 @@ FLAGS -c, --currentSession List out the current default session -h, --help Show CLI help. -n, --name= [default: New Default Session] Give a name for the default session - -s, --session= set path to a file containing session in json format + -s, --session= set path to a file containing session in json format (required, unless using + delete/currentSession flags) --delete Delete any existing default session. --out= synonym for target --target= path to config file in JB2 installation directory to write out to @@ -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 ``` diff --git a/products/jbrowse-cli/src/commands/__snapshots__/set-default-session.test.ts.snap b/products/jbrowse-cli/src/commands/__snapshots__/set-default-session.test.ts.snap index 42b7973bc4..35084f1cfd 100644 --- a/products/jbrowse-cli/src/commands/__snapshots__/set-default-session.test.ts.snap +++ b/products/jbrowse-cli/src/commands/__snapshots__/set-default-session.test.ts.snap @@ -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"`; diff --git a/products/jbrowse-cli/src/commands/set-default-session.ts b/products/jbrowse-cli/src/commands/set-default-session.ts index 94791adc0c..4cad4b8718 100644 --- a/products/jbrowse-cli/src/commands/set-default-session.ts +++ b/products/jbrowse-cli/src/commands/set-default-session.ts @@ -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', @@ -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,