-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathmake_stubs_nuget.py
More file actions
30 lines (23 loc) · 960 Bytes
/
make_stubs_nuget.py
File metadata and controls
30 lines (23 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sys
import os
import helpers
print('Script to generate stub file from a nuget package')
print(' Usage: python3 ' + sys.argv[0] +
' TEMPLATE NUGET_PACKAGE_NAME [VERSION=latest] [WORK_DIR=tempDir]')
print(' The script uses the dotnet cli, codeql cli, and dotnet format global tool')
print(' TEMPLATE should be either classlib or webapp, depending on the nuget package. For example, `Swashbuckle.AspNetCore.Swagger` should use `webapp` while `newtonsoft.json` should use `classlib`.')
if len(sys.argv) < 2:
print("\nPlease supply a template name.")
exit(1)
if len(sys.argv) < 3:
print("\nPlease supply a nuget package name.")
exit(1)
thisScript = sys.argv[0]
template = sys.argv[1]
nuget = sys.argv[2]
version = helpers.get_argv(3, "latest")
relativeWorkDir = helpers.get_argv(4, "tempDir")
generator = helpers.Generator(thisScript, relativeWorkDir, template)
generator.add_nuget(nuget, version)
generator.make_stubs()
exit(0)