我正在寻找一个可以创建目录并在之后直接将我带到该目录的命令,类似于:
$ mkdir project-one-business-dev-2
$ cd project-one-business-dev-2
Run Code Online (Sandbox Code Playgroud)
我不想输入两次项目名称,因为它太长(我知道我可以使用制表符,但如果有相似的名称怎么办?)。也许只有一个命令可以做到这一点。
正如 Laravel 官方文档所述,我执行了以下命令:
namespace App\Console\Commands;
use App\Model\Report;
use Illuminate\Console\Command;
use Exception;
class ExportAnualReport extends Command
{
/**
* @var string
*/
protected $description = "Print Anual Report";
/**
* @var string
*/
protected $signature = "report:anual";
public function __construct()
{
parent::__construct();
}
public function handle(Report $report): int
{
//@todo Implement Upload
try {
$reportData = $report->getAnualReport();
$this->table($reportData['headers'], $reportData['data']);
return 0;
} catch (Exception $e) {
$this->error($e->getMessage());
return 1;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我已经遵循了 Laravel 的方法和建议,而不是这个问题中使用的方法 ,并且利用依赖注入来将我的模型作为服务插入。
所以我同时认为对它进行单元测试是一个好主意: …
我使用 Xamarin 团队从https://learn.microsoft.com/ru-ru/xamarin/xamarin-forms/app-fundamentals/behaviors/reusable/event-to-command-behavior提供的 EventToCommandBehavior 。我需要它仅通过视图模型来操作 Xamarin.Forms.Map 控件事件。案例:处理点击事件,然后获取点的位置...
<gmap:Map x:Name="map">
<gmap:Map.Behaviors>
<behaviors:EventToCommandBehavior
EventName="MapClicked"
Command="{Binding ClickMapCommand}"
CommandParameter="{???}"/>
</gmap:Map.Behaviors>
</gmap:Map>
Run Code Online (Sandbox Code Playgroud)
一切正常,但我不知道如何将 Xamarin.Forms.GoogleMaps.MapClickedEventArgs 的 Point 属性作为命令参数传递。谢谢你的时间!
我的 .yaml 看起来像这样:
apiVersion: batch/v1
kind: Job
metadata:
name: foo
namespace: bar
spec:
template:
spec:
imagePullSecrets:
- name: $DOCKERHUB_REGISTRY_SECRET
containers:
- name: django
image: $DOCKERHUB_USER/$DOCKERHUB_IMAGENAME:$VERSION
command: [ 'python manage.py makemigrations' ]
:
Run Code Online (Sandbox Code Playgroud)
不过,我看到了很多替代方案command:
command: [ 'python', 'manage.py', 'makemigrations' ]
Run Code Online (Sandbox Code Playgroud)
command: [ '/bin/sh -c', 'python', 'manage.py', 'makemigrations' ]
Run Code Online (Sandbox Code Playgroud)
command: [ '/bin/sh', '-c' ]
args: [ 'python', 'manage.py', 'makemigrations' ]
Run Code Online (Sandbox Code Playgroud)
command: [ 'python' ]
args: [ 'manage.py', 'makemigrations' ]
Run Code Online (Sandbox Code Playgroud)
ETC。
从美学上来说,我更喜欢最后一种方法,因为它清楚地将命令与参数分开。
但我想检查一下:这些版本之间有什么细微的区别吗?是否存在任何令人信服的逻辑来支持其中一个而不是其他?
当我打开终端时,它突然显示
/Users/mine/.rvm/scripts/rvm:12: command not found: uname
/Users/mine/.rvm/scripts/rvm:29: command not found: ps
Run Code Online (Sandbox Code Playgroud)
然后我尝试运行flutter devices或其他类似的东西git status,它说zsh: command not found: flutter
有办法解决它吗?
[编辑]
Last login: Mon Feb 1 09:43:50 on ttys000
/Users/umsi06/.rvm/scripts/rvm:12: command not found: uname
/Users/umsi06/.rvm/scripts/rvm:29: command not found: ps
umsi06@umsi06s-MacBook-Pro ~ % ls
zsh: command not found: ls
umsi06@umsi06s-MacBook-Pro ~ % PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
umsi06@umsi06s-MacBook-Pro ~ % export PATH
umsi06@umsi06s-MacBook-Pro ~ % exec /bin/zsh
umsi06@umsi06s-MacBook-Pro ~ % ls
zsh: command not found: ls
umsi06@umsi06s-MacBook-Pro ~ %
Run Code Online (Sandbox Code Playgroud)
[第二次编辑]
+/Users/umsi06/.zshrc:1> …Run Code Online (Sandbox Code Playgroud) @slash.slash(name=\'spam\', description=\'I will spam your content for times!\', options=optionsspam, guild_ids=[847769978308526090])\nasync def spam(ctx, text: str, times: int="15"):\n if bool(times):\n Times = 15\n else:\n Times = times\n \n for i in range(int(Times)):\n await ctx.send(text)\n await asyncio.sleep(.7)\nRun Code Online (Sandbox Code Playgroud)\n结果是:\n\n它不断回复机器人发送的第一条消息。我不\xe2\x80\x99不希望机器人回复。我希望它只发送一条正常的消息。如何?
\n我想检查我的机器(RedHat)上的 perl 脚本中是否存在命令。
我试图检查是否compgen -c包含所需的命令,但从脚本内部运行它只会给我一个空的输出。其他命令工作正常。
示例.pl:
my $x = `compgen -c`;
print $x;
# empty output
my $y = `ls -a`;
print $y;
# .
# ..
# example.pl
Run Code Online (Sandbox Code Playgroud)
有可能的解决方案吗?或者有更好的方法来检查我的机器上的命令吗?
如何在命令行中更改Emac的默认字体大小,而不是emacs的X版本?
当它出错时,我希望他做两件事.
所以我想:
$rVraagOp = mysql_query( $qVraagOp ) or die( echo nl2br($qVraagOp); mysql_error(); );
Run Code Online (Sandbox Code Playgroud)
我可以编写一个执行这两项操作的函数,然后调用它,但这有点多余.还有另外一种方法吗?
Matthy
我通过命令属性将命令绑定到按钮,并在放置的页面中执行命令绑定.在execute方法中,我创建一个包含后台worker的类的实例,然后启动它(这是一个很长的任务).后台worker(bw)类包含一个变量isRunning,它在执行DoWork方法之前设置为true,在执行RunWorkerCompleted时设置为false.因此,从放置按钮的页面后面的代码,在CanExecute方法中,如果bw没有运行(isRunning = false),则将e.canExecute设置为true,如果isRunning = true,则将e.canExecute设置为false.
当我按下按钮时,它会长时间启动bw进程并且该按钮被禁用.确定这是正确的,但是当后台工作人员(bw)完成时,按钮不会返回启用,直到我再次按下它.当它被禁用时我按下(当bw完成时)它被启用.为什么按钮没有自动返回到bw结束时启用?
我的代码片段:
<Page x:Class="GParts.Pages.MyPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;
assembly=PresentationFramework.Aero"
xmlns:local="clr-namespace:GParts"
Loaded="Page_Loaded"
Unloaded="Page_Unloaded"
Height="Auto">
<Page.CommandBindings>
<CommandBinding Command="{x:Static local:Pages.MyPage.rcmd}"
Executed="CommandBinding_Executed"
CanExecute="CommandBinding_CanExecute"/>
</Page.CommandBindings>
<...>
<Button Command="{x:Static local:Pages.MyPage.rcmd}" />
<...>
</Page>
Run Code Online (Sandbox Code Playgroud)
页面背后的代码:
namespace GParts.Pages
{
public partial class MyPage : Page
{
public static RoutedCommand rcmd = new RoutedCommand();
private cBgWorker bw;
<...>
// ExecutedRoutedEventHandler for the custom button remove all command.
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
{
// get an isntance of the background worker class
bw = …Run Code Online (Sandbox Code Playgroud)