MCPcopy
hub / github.com/npm/node-semver / main

Function main

bin/semver.js:37–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35let options = {}
36
37const main = () => {
38 if (!argv.length) {
39 return help()
40 }
41 while (argv.length) {
42 let a = argv.shift()
43 const indexOfEqualSign = a.indexOf('=')
44 if (indexOfEqualSign !== -1) {
45 const value = a.slice(indexOfEqualSign + 1)
46 a = a.slice(0, indexOfEqualSign)
47 argv.unshift(value)
48 }
49
50 switch (a) {
51 case '-rv': case '-rev': case '--rev': case '--reverse':
52 reverse = true
53 break
54 case '-l': case '--loose':
55 loose = true
56 break
57 case '-p': case '--include-prerelease':
58 includePrerelease = true
59 break
60 case '-v': case '--version':
61 versions.push(argv.shift())
62 break
63 case '-i': case '--inc': case '--increment':
64 if (semver.RELEASE_TYPES.includes(argv[0]) || (argv[0] === 'release')) {
65 inc = { value: argv.shift(), maybeErrantValue: null, option: a }
66 } else {
67 inc = { value: 'patch', maybeErrantValue: argv[0], option: a }
68 }
69 break
70 case '--preid':
71 identifier = argv.shift()
72 break
73 case '-r': case '--range':
74 range.push(argv.shift())
75 break
76 case '-n':
77 identifierBase = argv.shift()
78 if (identifierBase === 'false') {
79 identifierBase = false
80 }
81 break
82 case '-c': case '--coerce':
83 coerce = true
84 break
85 case '--rtl':
86 rtl = true
87 break
88 case '--ltr':
89 rtl = false
90 break
91 case '-h': case '--help': case '-?':
92 return help()
93 default:
94 versions.push(a)

Callers 1

semver.jsFile · 0.70

Calls 5

helpFunction · 0.85
parseOptionsFunction · 0.85
failFunction · 0.85
failIncFunction · 0.85
incMethod · 0.80

Tested by

no test coverage detected