Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Move cli.ts in a private shared directory

Chocobozzz1a73a7dcd0d3
diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts
index 051156d668..c853469c27 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 d59a3632e4..71a4826e8f 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 <url>', 'Server url')
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index 938eed0ef5..bbdaa09c0b 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 c51d9ebd14..0660c855f6 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 5c82fa4203..fd6c760b23 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 114fe8a290..87da550050 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 1d3158044c..b79917b4fe 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 4607d052a9..e010ab320e 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 0000000000..8a3f31e2f3
--- /dev/null
+++ b/server/tools/shared/index.ts
@@ -0,0 +1 @@
+export * from './cli'