mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Merge pull request #17212 from atom/mb-remove-project-flags
Remove 'project' command line flag
This commit is contained in:
@@ -204,7 +204,6 @@ class AtomApplication extends EventEmitter {
|
||||
|
||||
openWithOptions (options) {
|
||||
const {
|
||||
projectSpecification,
|
||||
initialPaths,
|
||||
pathsToOpen,
|
||||
executedFrom,
|
||||
@@ -259,7 +258,6 @@ class AtomApplication extends EventEmitter {
|
||||
profileStartup,
|
||||
clearWindowState,
|
||||
addToLastWindow,
|
||||
projectSpecification,
|
||||
env
|
||||
})
|
||||
} else if (urlsToOpen.length > 0) {
|
||||
@@ -829,7 +827,6 @@ class AtomApplication extends EventEmitter {
|
||||
window,
|
||||
clearWindowState,
|
||||
addToLastWindow,
|
||||
projectSpecification,
|
||||
env
|
||||
} = {}) {
|
||||
if (!pathsToOpen || pathsToOpen.length === 0) return
|
||||
@@ -863,7 +860,7 @@ class AtomApplication extends EventEmitter {
|
||||
}
|
||||
|
||||
let openedWindow
|
||||
if (existingWindow && (projectSpecification == null || projectSpecification.config == null)) {
|
||||
if (existingWindow) {
|
||||
openedWindow = existingWindow
|
||||
openedWindow.openLocations(locationsToOpen)
|
||||
if (openedWindow.isMinimized()) {
|
||||
@@ -899,7 +896,6 @@ class AtomApplication extends EventEmitter {
|
||||
windowDimensions,
|
||||
profileStartup,
|
||||
clearWindowState,
|
||||
projectSpecification,
|
||||
env
|
||||
})
|
||||
this.addWindow(openedWindow)
|
||||
|
||||
@@ -22,7 +22,6 @@ class AtomWindow extends EventEmitter {
|
||||
this.safeMode = settings.safeMode
|
||||
this.devMode = settings.devMode
|
||||
this.resourcePath = settings.resourcePath
|
||||
this.projectSpecification = settings.projectSpecification
|
||||
|
||||
let {pathToOpen, locationsToOpen} = settings
|
||||
if (!locationsToOpen && pathToOpen) locationsToOpen = [{pathToOpen}]
|
||||
@@ -60,8 +59,7 @@ class AtomWindow extends EventEmitter {
|
||||
get: () => JSON.stringify(Object.assign({
|
||||
userSettings: !this.isSpec
|
||||
? this.atomApplication.configFile.get()
|
||||
: null,
|
||||
projectSpecification: this.projectSpecification
|
||||
: null
|
||||
}, this.loadSettings))
|
||||
})
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ const yargs = require('yargs')
|
||||
const {app} = require('electron')
|
||||
const path = require('path')
|
||||
const fs = require('fs-plus')
|
||||
const CSON = require('season')
|
||||
|
||||
module.exports = function parseCommandLine (processArgs) {
|
||||
const options = yargs(processArgs).wrap(yargs.terminalWidth())
|
||||
@@ -53,7 +52,6 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
'When in test mode, waits until the specified time (in minutes) and kills the process (exit code: 130).'
|
||||
)
|
||||
options.alias('v', 'version').boolean('v').describe('v', 'Print the version information.')
|
||||
options.alias('p', 'project').describe('p', 'Start Atom with a project specification file.')
|
||||
options.alias('w', 'wait').boolean('w').describe('w', 'Wait for window to be closed before returning.')
|
||||
options.alias('a', 'add').boolean('a').describe('add', 'Open path as a new project in last used window.')
|
||||
options.string('socket-path')
|
||||
@@ -93,7 +91,6 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
const benchmark = args['benchmark']
|
||||
const benchmarkTest = args['benchmark-test']
|
||||
const test = args['test']
|
||||
const projectSpecificationFile = args['project']
|
||||
const mainProcess = args['main-process']
|
||||
const timeout = args['timeout']
|
||||
const newWindow = args['new-window']
|
||||
@@ -128,7 +125,6 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if project flag is set, then add all paths from the .atomproject.
|
||||
if (args['resource-path']) {
|
||||
devMode = true
|
||||
devResourcePath = args['resource-path']
|
||||
@@ -138,28 +134,6 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
devMode = true
|
||||
}
|
||||
|
||||
let projectSpecification = {}
|
||||
if (projectSpecificationFile) {
|
||||
const readPath = path.isAbsolute(projectSpecificationFile)
|
||||
? projectSpecificationFile
|
||||
: path.join(executedFrom, projectSpecificationFile)
|
||||
|
||||
const contents = Object.assign({}, readProjectSpecificationSync(readPath, executedFrom))
|
||||
const pathToProjectFile = path.join(executedFrom, projectSpecificationFile)
|
||||
|
||||
const base = path.dirname(pathToProjectFile)
|
||||
pathsToOpen.push(path.dirname(projectSpecificationFile))
|
||||
const paths = (contents.paths == null)
|
||||
? undefined
|
||||
: contents.paths.map(curPath => path.resolve(base, curPath))
|
||||
|
||||
projectSpecification = {
|
||||
originPath: pathToProjectFile,
|
||||
paths,
|
||||
config: contents.config
|
||||
}
|
||||
}
|
||||
|
||||
if (devMode) {
|
||||
resourcePath = devResourcePath
|
||||
}
|
||||
@@ -178,7 +152,6 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
devResourcePath = normalizeDriveLetterName(devResourcePath)
|
||||
|
||||
return {
|
||||
projectSpecification,
|
||||
resourcePath,
|
||||
devResourcePath,
|
||||
pathsToOpen,
|
||||
@@ -204,18 +177,6 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
}
|
||||
}
|
||||
|
||||
function readProjectSpecificationSync (filepath, executedFrom) {
|
||||
let contents
|
||||
try {
|
||||
contents = CSON.readFileSync(filepath)
|
||||
} catch (e) {
|
||||
throw new Error('Unable to read supplied project specification file.')
|
||||
}
|
||||
|
||||
contents.config = (contents.config == null) ? {} : contents.config
|
||||
return contents
|
||||
}
|
||||
|
||||
function normalizeDriveLetterName (filePath) {
|
||||
if (process.platform === 'win32') {
|
||||
return filePath.replace(/^([a-z]):/, ([driveLetter]) => driveLetter.toUpperCase() + ':')
|
||||
|
||||
Reference in New Issue
Block a user