使用命令行在OS X上启动应用程序(Launch an app on OS X with command line)
我想从一个脚本在OSX上启动一个应用程序。 我需要传递命令行参数。 不幸的是,'open'不接受命令行参数。
我可以想到的唯一选择是使用'nohup myApp> / dev / null&'启动我的应用程序,因此它可以独立于启动它的脚本存在。
任何更好的建议?
I want to launch an app on OSX from a script. I need pass it command line arguments. Unfortunately,
open
doesn't accept command line args.The only option I can think of is to use
nohup myApp > /dev/null &
to launch my app so it can exist independently of the script that launches it.Any better suggestions?
原文:https://stackoverflow.com/questions/1308755
更新时间:2023-11-22 06:11
最满意答案
假设您的
App.request()
方法返回一个jQuery承诺,您可以创建它们的数组以应用于$.when
:var t = [], requests = []; _.each(searchData.get("products"), function(productId, index){ requests.push(App.request("product:entity", productId).done(function(product) { t.push(product); }); }); $.when.apply($, requests).done(function() { console.log(t); });
Assuming that your
App.request()
method returns a jQuery promise, you can create an array of them to apply to$.when
:var t = [], requests = []; _.each(searchData.get("products"), function(productId, index){ requests.push(App.request("product:entity", productId).done(function(product) { t.push(product); }); }); $.when.apply($, requests).done(function() { console.log(t); });
相关问答
更多-
使用`cycle-http`发出任意数量的顺序依赖请求(Making an arbitrary number of sequential, dependent requests with `cycle-http`)[2023-08-11]
这是使用Cycle.js和@cycle @cycle/fetch驱动程序对任意数量的顺序相关请求的另一种看法。 (使用GitHub用户API。用户查询每页返回30个用户,从而URL参数是用户ID号,并在下一个用户ID处启动查询。) 首先是main功能的主要部分,带有注释: const listResponse$ = sources.FETCH // response returned from FETCH driver .mergeAll() .flatMap(res => res.json()) ... -
将任意数量的参数传递给perl中的Oracle函数(Passing arbitrary number of parameters to an Oracle function in perl)[2021-12-25]
像这样的东西可以工作: sub callStoredFunction { my ($funcName, @parameters) = @_; my $paramStr = join(', ', map { "value$_ => Param$_" } (1 .. scalar(@parameters)); my $func = $dbh->prepare(sprintf("\n{\nBEGIN\n:result := $funcName( ... -
假设您的App.request()方法返回一个jQuery承诺,您可以创建它们的数组以应用于$.when : var t = [], requests = []; _.each(searchData.get("products"), function(productId, index){ requests.push(App.request("product:entity", productId).done(function(product) { t.push(product); ...
-
对于这种情况, d3-queue似乎完全没问题。 以下代码段应该足以处理任意数量的文件的加载: function loadFiles(files) { // Create a new queue to handle the loading of all files. var q = d3.queue(); // Iterate over the array of all files to be loaded. files.forEach(function(f) { // Add ...
-
Racket,使用任意数量的参数执行任意功能(Racket, execute arbitrary function with arbitrary number of parameters)[2024-03-15]
您正在寻找的是apply和休息参数: (define (gen-func func . args) (apply func args)) 点参数列表func . args func . args在第一个被收集到列表args之后导致所有args 。 这有效的原因是(func . args)与(cons func args) ,因此当调用该函数时, func设置为(car arglist) , args设置为(cdr arglist) ,这是第一个之后的参数列表。 What you are lookin ... -
LibreOffice Calc自定义函数,具有任意数量的参数(LibreOffice Calc Custom Function with arbitrary number of arguments)[2022-10-12]
使用Excel VBA可以使用ParamArray: https : //msdn.microsoft.com/en-us/library/538f81ec.aspx 。 至少使用Libreoffice的最新版本,如果设置了Option Compatible也可以使用ParamArray。 例: Option Compatible public function sum_custom(ParamArray arr_args() as Variant) as Double sum_custom = 0 ... -
如何最好地在javascript中的任意对象上调用任意方法?(How best to invoke arbitrary methods on arbitrary objects in javascript?)[2023-02-27]
这应该工作: function applyArbitraryMethod(method, args) { method.apply(this, args); } applyArbitraryMethod(Object.method, args); I did not end up finding a more straightforward solution. So my current correct answer sits at: function applyArbitraryMethod( ... -
在javascript中将任意数量的参数传递给函数(Passing arbitrary number of parameter to a function in javascript)[2020-02-14]
如果将所有参数放入数组(让我们称之为foo ),则可以使用apply -function调用带有这些参数的函数fn 。 fn.apply(null, foo) 第一个参数(在这种情况下为null )是您希望this在被调用函数内的任何内容。 null可能对你有用。 If you put all your arguments into an array (lets call it foo), you can call a function fn with those arguments by using t ... -
不需要地图,只需跟踪数组就可以跟踪它们。 (这不会检查数组是否具有相同的长度 - ) function sumArrayElements(){ var arrays= arguments, results= [], count= arrays[0].length, L= arrays.length, sum, next= 0, i; while(next您可以使用此ES6函数,该函数不会改变任何输入对象,但会返回一个新的: function intersectObjects(...objects) { return !objects.length ? {} : Object.assign(...Object.keys(objects[0]).filter( key => objects.every( o => key in o ) ).map( key => ({ [k ...
相关文章
更多- 使用命令行编译Kotlin程序
- 《Windows 命令行详解手册(第2版)》(Windows Command-Line Administrator's Pocket Consultant, 2nd Edition)扫描版[PDF]
- 【原】storm源码之mac os x编译twitter storm源码
- 使用Maven命令行快速创建项目骨架(archetype)
- Mac OS X 10.7.2下搭建hadoop1.0.3伪分布式模式
- 【Hadoop实战】在Mac OS上配置Hadoop伪分布式环境
- Linux命令行和shell脚本编程宝典.pdf
- 【Hadoop实战】在Mac OS上编译 Hadoop Pipes 库
- Zookeeper CLI 命令行操作
- storm client command
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)