diff --git a/.gitignore b/.gitignore index beb798d..0049f8c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ slack-archive .DS_Store *.log .token -lib \ No newline at end of file +lib +.env diff --git a/README.md b/README.md index 09f50b2..34ac7d7 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ npx slack-archive --channel-types Comma-separated list of channel types to fetch messages from. (public_channel, private_channel, mpim, im) --exclude-channels Comma-separated list of channels to exclude, in automatic mode +--output Specify custom output directory (default: ./slack-archive) --no-backup: Don't create backups. Not recommended. --no-search: Don't create a search file, saving disk space. --no-file-download: Don't download files. @@ -53,7 +54,7 @@ This will be mostly painless, I promise. Head over to https://api.slack.com/apps and `Create New App`. Select `From scratch`. Give it a name and choose the workspace you'd like to export. -Then, from the `Features` menu on the left, select `OAuth & Permission`. +Then, from the `Features` menu on the left, select `OAuth & Permission`. As a redirect URL, enter something random that doesn't actually exist, or a domain you control. For instace: @@ -100,9 +101,9 @@ https://notarealurl.com/?code={code}&state= Copy everything between `?code=` and `&state`. This is your `code`. We'll need it in the next step. -Next, we'll exchange your code for a token. To do so, we'll also need your `client secret` -from the first step when we created your app. In a browser, open this URL - replacing -`{your-team-name}`, `{your-client-id}`, `{your-code}` and `{your-client-secret}` with +Next, we'll exchange your code for a token. To do so, we'll also need your `client secret` +from the first step when we created your app. In a browser, open this URL - replacing +`{your-team-name}`, `{your-client-id}`, `{your-code}` and `{your-client-secret}` with your values. ``` diff --git a/src/cli.ts b/src/cli.ts index d54d62d..8167f9f 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -264,6 +264,7 @@ async function getAuthTest() { export async function main() { console.log(`Welcome to slack-archive${getLastSuccessfulRun()}`); + console.log(`Output will be saved to: ${OUT_DIR}`); if (AUTOMATIC_MODE) { console.log(`Running in fully automatic mode without prompts`); diff --git a/src/config.ts b/src/config.ts index 67a52f8..51e7adc 100644 --- a/src/config.ts +++ b/src/config.ts @@ -45,8 +45,9 @@ export const FORCE_HTML_GENERATION = findCliParameter( "--force-html-generation" ); export const EXCLUDE_CHANNELS = getCliParameter("--exclude-channels"); +export const OUTPUT_DIR = getCliParameter("--output"); export const BASE_DIR = process.cwd(); -export const OUT_DIR = path.join(BASE_DIR, "slack-archive"); +export const OUT_DIR = OUTPUT_DIR ? path.resolve(OUTPUT_DIR) : path.join(BASE_DIR, "slack-archive"); export const TOKEN_FILE = path.join(OUT_DIR, ".token"); export const DATE_FILE = path.join(OUT_DIR, ".last-successful-run"); export const DATA_DIR = path.join(OUT_DIR, "data");