简体   繁体   English

将Codeception供应商路径与Linux链接

[英]Link Codeception Vendor Path with Linux

Right now I have a project here: 现在我在这里有一个项目:

/srv/www/web/src/private/protected / srv / www / web / src / private / protected

It has a /vendors/ folder with /codeception in it. 它有一个/ vendors /文件夹,其中带有/ codeception。 I have to currently do: 我目前必须做:

./vendor/codeception/codeception/codecept run ./vendor/codeception/codeception/codecept运行

How can I link this directory/command 'codecept' so I don't have to type the absolute path every time? 如何链接此目录/命令“ codecept”,这样我不必每次都键入绝对路径?

I want: 我想要:

codecept run Codecept运行

Instead of: 代替:

./vendor/codeception/codeception/codecept run ./vendor/codeception/codeception/codecept运行

In your project folder you could 在您的项目文件夹中,您可以

ln -s vendor/codeception/codeception/codecept .

to create a symlink in the current folder. 在当前文件夹中创建符号链接。

concatenate it to $PATH environment variable 将其连接到$ PATH环境变量

PATH=$PATH:full_path_to_script

$PATH is an environment veritable used to find commands/scripts in wanted paths. $ PATH是一个可用于在所需路径中查找命令/脚本的环境。

each time you are looking for a script or command it looks at the Paths that are listed in this variable 每次查找脚本或命令时,它都会查看此变量中列出的路径

see your paths with: 通过以下方式查看您的路径:

  ~> echo $PATH 

我添加了这样的符号链接:sudo ln -s / srv / www / web / src / private / protected / vendor / codeception / codeception / codecept / usr / local / bin / codecept

Edit your ~/.bashrc (or ~/.bash_profile) . 编辑~/.bashrc (或~/.bash_profile) Add the following: 添加以下内容:

export PATH=$PATH:bin:vendor/bin

This will allow you to run any executables in both the bin/ and vendor/bin folders without having to cd into them. 这将使您可以运行bin/vendor/bin文件夹中的任何可执行文件,而无需cd进入它们。

You need to close and reopen your terminal for the change to take effect! 您需要关闭并重新打开终端才能使更改生效!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM