标签: command-line-interface

逃离linux cli for循环

我正在做这样的事情:

for f in `find -iname '*.html'`; do scp $f remoteserver:$f; done;
Run Code Online (Sandbox Code Playgroud)

我已经通过了1000个文件中的大约3个,我已经决定要中止操作了.

CTRL + C仅转义SCP登录提示并将我带到下一个,而不是转义for循环.

有没有比击中CTRL + C 9997次更好的方法?

谢谢!

linux bash command-line-interface

1
推荐指数
1
解决办法
320
查看次数

SVN cli提交转义字符

在命令提示符下使用SVN我通常在同一行中提交提交消息.例如:

svn commit -m "Initial checkin"

当我想使用shell保留字符时,例如感叹号:

svn commit -m "It finally works!"

它将作为错误发出,因为shell正在尝试执行除svn命令之外的其他操作.所以我可以逃脱砰的一声:

svn commit -m "woohoo\!"

然后提交很好,但现在我的提交消息字面上说woohoo\!.有没有办法没有使用消息编辑器屏幕(我认为它是vim或nano),你的消息可以让这样的东西正确显示?

svn command-line-interface

1
推荐指数
1
解决办法
1379
查看次数

python类CLI变量转储

当我在交互式shell中使用python时,我可以通过调用它们的名称轻松转储变量.

>>> x = b'\xA5'
>>> x
'\xa5'
>>> print x
?
Run Code Online (Sandbox Code Playgroud)

如您所见,行为与行为不同print.如何在普通脚本中模拟这个类似CLI的变量转储?

python command-line-interface

1
推荐指数
1
解决办法
453
查看次数

正确测量像素中的字符

我正在编写一个从头开始的文本框,以便优化语法高亮.但是,我需要以像素为单位获得字符的宽度,而不是像Graphics :: MeasureString给我的垃圾.我在网上发现了很多东西,特别是这个,然而,它似乎都没有用,或者没有考虑到标签.我需要以最快的方式来测量字符的精确尺寸(以像素为单位)和制表符空间.我似乎无法想出这一个......

应该提到我正在使用C++,CLR/CLI和GDI +


这是我的测量功能.在另一个函数中,它返回的RectangleF被绘制到屏幕:

RectangleF TextEditor::MeasureStringWidth(String^ ch, Graphics^ g, int xDistance, int lineYval)
{
    RectangleF measured;
    Font^ currentFont = gcnew Font(m_font, (float)m_fontSize);
    StringFormat^ stringFormat = gcnew StringFormat;
    RectangleF layout = RectangleF(xDistance,lineYval,35,m_fontHeightPix);
    array<CharacterRange>^ charRanges = {CharacterRange(0,1)};
    array<Region^>^ strRegions;

    stringFormat->FormatFlags = StringFormatFlags::DirectionVertical;
    stringFormat->SetMeasurableCharacterRanges(charRanges);

    strRegions = g->MeasureCharacterRanges(ch, currentFont, layout, stringFormat);

    if(strRegions->Length >= 1)
        measured = strRegions[0]->GetBounds(g);
    else
        measured = RectangleF(0,0,0,0);

    return measured;
}
Run Code Online (Sandbox Code Playgroud)

我真的不明白MeasureCharacterRanges layoutRect参数的作用.我修改了Microsofts示例中的代码,仅使用或仅测量一个字符.

c++ clr gdi+ command-line-interface

1
推荐指数
1
解决办法
1953
查看次数

通过命令行运行控制器.问题连接到数据库

背景:使用unix,来自localhost的codeigniter.

我想通过命令行(CLI)运行控制器.因此,我正在遵循此CodeIgniter教程 ,该示例工作正常.

但是,当我将它与需要连接到数据库的函数一起使用时,它会在命令行中出现以下错误.

Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 347
Run Code Online (Sandbox Code Playgroud)

奇怪的是当我通过URL访问相同的功能时它起作用.怎么可能?

注意:我假装在命令行中引入的函数是更新数据库(它不打印任何东西).

编辑: 我越来越近了.我已将主机名从"localhost"更改为"127.0.0.1"并且可以正常工作.为什么?

database database-connection codeigniter command-line-interface

1
推荐指数
1
解决办法
2913
查看次数

Eclipse p2 Director应用程序无法更新功能

我正在开发Node.js脚本,以使用Eclipse内置的p2 Director应用程序安装Eclipse插件。在某些情况下,p2-director无法更新功能。

D:\Workspaces\Nodeclipse-DEV\nodeclipse-1\org.nodeclipse.ui\templates>node nodeclipse-install.js install -repository jar:file:/D:/Workspaces/Nodeclipse-DEV/nodeclipse-1/org.nodeclipse.site/target/org.nodeclipse.site-0.10.0-SNAPSHOT.zip!/ maven
Nodeclipse CLI Installer (Eclipse Plugin Manager epm)
starting eclipsec -nosplash -application org.eclipse.equinox.p2.director -repository jar:file:/D:/Workspaces/Nodeclipse-DEV/nodeclipse-1/org.nodeclipse.site/target/org.nodeclipse.site-0.10.0-SNAPSHOT.zip!/ -installIU org.nodeclipse.enide.maven.feature.feature.group -tag org.nodeclipse.enide.maven.feature.feature.group -vmargs -Declipse.p2.mirrors=false
Installing org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402180840.

Installation failed.

Cannot complete the install because of a conflicting dependency.
 Software being installed: Enide Maven 0.10.0.201402180840 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402180840)
 Software currently installed: Enide Maven 0.10.0.201402170319 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402170319)
 Only one of the following can be installed at once:
  Enide Maven 0.10.0.201402180840 (org.nodeclipse.enide.maven.feature.feature.jar 0.10.0.201402180840)
  Enide Maven …
Run Code Online (Sandbox Code Playgroud)

eclipse p2 command-line-interface nodeclipse p2-director

1
推荐指数
1
解决办法
1791
查看次数

通过mac中的命令行更新到svn 1.9.4

我违背自己的意愿使用SVN.我工作的当前团队使用它进行版本控制,并不总是可以帮助我.我只想尝试从SVN版本1.8.13到最新的1.9.4

我已下载它,我也运行了这个命令

curl -o subversion-latest.tar.gz http://apache.mirrors.tds.net/subversion/subversion-1.9.4.tar.gz
tar -xvf subversion-latest.tar.gz
Run Code Online (Sandbox Code Playgroud)

我把这两个不同的教程结合起来没有运气.

svn更新版本

堆栈流问题

我对这configure部分感到不安

mymac ~/Downloads/subversion-1.9.4/serf
$ ./configure
-bash: ./configure: No such file or directory
mymac ~/Downloads/subversion-1.9.4/serf
Run Code Online (Sandbox Code Playgroud)

UPDATE

我退出了农奴道路

`mymac ~/Downloads/subversion-1.9.4` file path i ran the `./configure` My command line ran a bunch of "checks" 
configure: Configuring Subversion 1.9.4 
configure: creating config.nice checking for gcc... 
gcc checking whether the C compiler works... 
Run Code Online (Sandbox Code Playgroud)

是的,但最终在最后拍摄错误......

configure: error: failed to recognize APR_INT64_T_FMT on this platform 
mymac ~/Downloads/subversion-1.9.4
Run Code Online (Sandbox Code Playgroud)
  • 我有最新版的XCode ..

UPDATE2再试一次霓虹灯

mymac ~/Downloads/subversion-1.9.4 …
Run Code Online (Sandbox Code Playgroud)

svn macos bash command-line-interface

1
推荐指数
1
解决办法
2391
查看次数

yargs .check()错误处理

我正在使用yargs来验证用于数据加载助手库的cli参数。

我希望能够在允许运行脚本之前检查文件是否存在,对此我可以这样做fs.accessSync(filename, fs.R_OK);。但是,如果文件不存在,则消息传递只是将.check()函数显示为错误,而我要拦截,并声明该文件不存在(具有读取权限)。

那么,如何在错误返回时发送由.check()呈现的错误?

这是我的观点的要点:

var path = {
  name: 'filepath',
  options: {
    alias: 'f',
    describe: 'provide json array file',
    demand: true,
  },
};

function fileExists(filename) {
  try {
    fs.accessSync(filename, fs.R_OK);
    return true;
  } catch (e) {
    return false;
  }
}

var argv = require('yargs')
  .usage('$0 [args]')
  .option(path.name, path.options)
  .check(function (argv) {
    return fileExists(argv.f);
  })
  .strict()
  .help('help')
  .argv;
Run Code Online (Sandbox Code Playgroud)

以及返回的错误(如果不是可读文件):

Argument check failed: function (argv) {
  return fileExists(argv.f);
}
Run Code Online (Sandbox Code Playgroud)

我希望能够按照以下方式指定一些内容: Argument check failed: filepath is not a …

command-line-interface node.js yargs

1
推荐指数
1
解决办法
2107
查看次数

在PhpStorm终端中返回和转发一个单词的命令箭头

我在OSX上,出于某种原因,当我在PhpStorm终端执行命令 - ←(后退箭头)时,我得到一个[D,而命令 - →(向前箭头)输出a [C.我想做的是向前跳一个字.

在此输入图像描述

在我的OSX终端中,这些按键按预期工作,我找不到设置输出这些字符的任何地方.有没有人能解决这个难题?

macos terminal keyboard-shortcuts command-line-interface phpstorm

1
推荐指数
1
解决办法
467
查看次数

如何理解git命令的结构?

如何理解git命令的结构?

   git remote add origin repo-url
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,哪一个是命令,哪一个是参数?

linux git command command-line-interface

1
推荐指数
1
解决办法
55
查看次数