diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts index 051156d66..c853469c2 100644 --- a/server/tools/peertube-auth.ts +++ b/server/tools/peertube-auth.ts @@ -1,7 +1,7 @@ import CliTable3 from 'cli-table3' import { OptionValues, program } from 'commander' import { isUserUsernameValid } from '../helpers/custom-validators/users' -import { assignToken, buildServer, getNetrc, getSettings, writeSettings } from './cli' +import { assignToken, buildServer, getNetrc, getSettings, writeSettings } from './shared' import prompt = require('prompt') diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts index d59a3632e..71a4826e8 100644 --- a/server/tools/peertube-get-access-token.ts +++ b/server/tools/peertube-get-access-token.ts @@ -1,5 +1,5 @@ import { program } from 'commander' -import { assignToken, buildServer } from './cli' +import { assignToken, buildServer } from './shared' program .option('-u, --url ', 'Server url') diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 938eed0ef..bbdaa09c0 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -13,7 +13,7 @@ import { buildVideoAttributesFromCommander, getLogger, getServerCredentials -} from './cli' +} from './shared' import prompt = require('prompt') diff --git a/server/tools/peertube-plugins.ts b/server/tools/peertube-plugins.ts index c51d9ebd1..0660c855f 100644 --- a/server/tools/peertube-plugins.ts +++ b/server/tools/peertube-plugins.ts @@ -2,7 +2,7 @@ import CliTable3 from 'cli-table3' import { Command, OptionValues, program } from 'commander' import { isAbsolute } from 'path' import { PluginType } from '../../shared/models' -import { assignToken, buildServer, getServerCredentials } from './cli' +import { assignToken, buildServer, getServerCredentials } from './shared' program .name('plugins') diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.ts index 5c82fa420..fd6c760b2 100644 --- a/server/tools/peertube-redundancy.ts +++ b/server/tools/peertube-redundancy.ts @@ -4,7 +4,7 @@ import { URL } from 'url' import validator from 'validator' import { forceNumber, uniqify } from '@shared/core-utils' import { HttpStatusCode, VideoRedundanciesTarget } from '@shared/models' -import { assignToken, buildServer, getServerCredentials } from './cli' +import { assignToken, buildServer, getServerCredentials } from './shared' import bytes = require('bytes') program diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts index 114fe8a29..87da55005 100644 --- a/server/tools/peertube-upload.ts +++ b/server/tools/peertube-upload.ts @@ -1,7 +1,7 @@ import { program } from 'commander' import { access, constants } from 'fs-extra' import { isAbsolute } from 'path' -import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli' +import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './shared' let command = program .name('upload') diff --git a/server/tools/peertube.ts b/server/tools/peertube.ts index 1d3158044..b79917b4f 100644 --- a/server/tools/peertube.ts +++ b/server/tools/peertube.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import { CommandOptions, program } from 'commander' -import { getSettings, version } from './cli' +import { getSettings, version } from './shared' program .version(version, '-v, --version') diff --git a/server/tools/cli.ts b/server/tools/shared/cli.ts similarity index 97% rename from server/tools/cli.ts rename to server/tools/shared/cli.ts index 4607d052a..e010ab320 100644 --- a/server/tools/cli.ts +++ b/server/tools/shared/cli.ts @@ -2,12 +2,11 @@ import { Command } from 'commander' import { Netrc } from 'netrc-parser' import { join } from 'path' import { createLogger, format, transports } from 'winston' +import { getAppNumber, isTestInstance } from '@server/helpers/core-utils' import { loadLanguages } from '@server/initializers/constants' import { root } from '@shared/core-utils' -import { UserRole } from '@shared/models' +import { UserRole, VideoPrivacy } from '@shared/models' import { PeerTubeServer } from '@shared/server-commands' -import { VideoPrivacy } from '../../shared/models/videos' -import { getAppNumber, isTestInstance } from '../helpers/core-utils' let configName = 'PeerTube/CLI' if (isTestInstance()) configName += `-${getAppNumber()}` diff --git a/server/tools/shared/index.ts b/server/tools/shared/index.ts new file mode 100644 index 000000000..8a3f31e2f --- /dev/null +++ b/server/tools/shared/index.ts @@ -0,0 +1 @@ +export * from './cli'