FarCmds (FAR Commands)

Здесь можно обсудить ваш любимый плагин.
User avatar
Raistlin
Posts: 750
Joined: Wed 16 Mar, 2005 16:01
Has thanked: 3 times
Been thanked: 1 time

Re: FarCmds (FAR Commands)

Post by Raistlin »

Latest post of the previous page:

Examples:

Execute the command "command" and redirect its output to the editor:
edit:<command

Possible cases with the parameter stream=1:
edit:<1 command
Magically yours
Raistlin
cyberwolf
Posts: 109
Joined: Tue 24 Mar, 2009 14:39
Been thanked: 2 times

Re: FarCmds (FAR Commands)

Post by cyberwolf »

I've checked the FarCmds help and you're right, the "<1" and "<2" are special command, sadly it doesn't seem to work.

Btw, the "<1" doesn't work, but the "<<1" does work, so you should use the following code (for the "dir" command it should do the same as the "<1" command):

Code: Select all

edit:<<1 dir
I don't know if it's intended to work like that or just a bug, from the help i get the idea that both "<1" and "<<1" should work.

Oh, and here's the part from FARCmdsEng.hlf regarding the stream settings :

Code: Select all

The plugin can redirect the output of the specified "<command" or "<<command". 
                                                                               
 command - [stream][mode][|path|]command.                                      
                                                                               
 stream - controls which output stream(s) to redirect.                         
          1 - redirect only standard output stream stdout.                     
          2 - redirect only standard output stream stderr.                     
          * - redirect stderr and stdout as one stream.                        
          ? - redirect stderr and stdout as different streams.                 
              For commands view and edit the streams will be opened            
              in separate windows. For other commands same behavior as *.      
          Default value of this parameter can be defined in config.
and even gives a sample (that doesn't work :( ) at the end :

Code: Select all

Examples:                                                            
                                                                     
 Execute the command "command" and redirect its output to the editor:
   edit:<command                                                     
                                                                     
 Possible cases with the parameter stream=1:                         
   edit:<1 command                                                   
   edit:<1"command"                                                  
   edit:<1+command                                                   
   edit:<1|%TEMP%|command
The examples only work if you use the double sign ("<<").
Sorry for writing in English in the Russian forums, but i don't speak Russian and don't trust online translators. :D

"There’s no teacher who can teach anything new He can just help us to remember the things we always knew." ~ ENIGMA
User avatar
Raistlin
Posts: 750
Joined: Wed 16 Mar, 2005 16:01
Has thanked: 3 times
Been thanked: 1 time

Re: FarCmds (FAR Commands)

Post by Raistlin »

from the help i get the idea that both "<1" and "<<1" should work
"<<1" is the undocumented syntax: according to Help mode should follow stream, not vice versa:
command - [stream][mode][|path|]command
Magically yours
Raistlin
User avatar
Raistlin
Posts: 750
Joined: Wed 16 Mar, 2005 16:01
Has thanked: 3 times
Been thanked: 1 time

Re: FarCmds (FAR Commands)

Post by Raistlin »

Magically yours
Raistlin
User avatar
John Doe
Бюрократ
Posts: 13862
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 74 times
Been thanked: 428 times
Contact:

Re: FarCmds (FAR Commands)

Post by John Doe »

Префикс far: теперь используется фаром.
Надо бы из плагина убрать, он там не особо нужен.

Сейчас при запуске префикса far: получаем справку плагина.

Update: http://bugs.farmanager.com/view.php?id=2701
White_Owl
Posts: 16
Joined: Thu 06 Feb, 2014 23:07

Re: FarCmds (FAR Commands)

Post by White_Owl »

Хотелка:
Хочу чтобы команда goto умела читать lnk файлы и переходить по ним (EMenu умеет их создавать, значит надо уметь их использовать).
Синтаксис можно оставить прежним. goto: <some.lnk
То есть, если файл текстовый - работать в прежнем режиме, если бинарный и с расширением lnk - прочитать, расшифровать и перейти куда сказано.
User avatar
Skirda
Posts: 3475
Joined: Wed 16 Mar, 2005 11:01
Been thanked: 8 times

Re: FarCmds (FAR Commands)

Post by Skirda »

White_Owl wrote:Хотелка:
Хочу чтобы команда goto умела читать lnk файлы и переходить по ним
В аттаче оно?
Attachments
farcmds_103.zip
(29.28 KiB) Downloaded 145 times
We are the Borg. You will be assimilated.
So Say We All!
User avatar
Skirda
Posts: 3475
Joined: Wed 16 Mar, 2005 11:01
Been thanked: 8 times

Re: FarCmds (FAR Commands)

Post by Skirda »

В общем "goto:<some.lnk" закоммитил - build 103.
We are the Borg. You will be assimilated.
So Say We All!
User avatar
Skirda
Posts: 3475
Joined: Wed 16 Mar, 2005 11:01
Been thanked: 8 times

Re: FarCmds (FAR Commands)

Post by Skirda »

Префикс "run:" актуален?
Кто юзает, поделитесь примерами (для понимания масштабов бедствия, если префикс убрать)
We are the Borg. You will be assimilated.
So Say We All!
User avatar
John Doe
Бюрократ
Posts: 13862
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 74 times
Been thanked: 428 times
Contact:

Re: FarCmds (FAR Commands)

Post by John Doe »

Бедствия не предвидится, но зачем убирать?
Да, почти то же самое можно сделать одним только cmd.exe, но:
  • У run общий синтаксис с остальными командами FarCmds, что делает использование проще
  • run ищет запускаемые утилиты в большем числе мест, чем cmd.
    Может запускать и алиасы
  • Процесс перенаправления вывода сопровождается выводом прогресса.
    Больше возможностей по скрытию/отображению вывода (или я не умею пользоваться cmd)
User avatar
Skirda
Posts: 3475
Joined: Wed 16 Mar, 2005 11:01
Been thanked: 8 times

Re: FarCmds (FAR Commands)

Post by Skirda »

John Doe wrote:У run общий синтаксис с остальными командами FarCmds, что делает использование проще
А это?.
Мне кажется несколько несуразица в синтаксисе run`а. Не?
We are the Borg. You will be assimilated.
So Say We All!
User avatar
John Doe
Бюрократ
Posts: 13862
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 74 times
Been thanked: 428 times
Contact:

Re: FarCmds (FAR Commands)

Post by John Doe »

В настоящий момент команда run в отличии от других работает только с перенаправлением.
В этом несуразица?
Это же легко поправимо, о том и тикет.

P.S.
Не то чтобы я большой поклонник команды run.
Просто не вижу смысла отламывать то что работает.
User avatar
Skirda
Posts: 3475
Joined: Wed 16 Mar, 2005 11:01
Been thanked: 8 times

Re: FarCmds (FAR Commands)

Post by Skirda »

Mantis#1199.
Удаляем "link:" ?
We are the Borg. You will be assimilated.
So Say We All!
User avatar
John Doe
Бюрократ
Posts: 13862
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 74 times
Been thanked: 428 times
Contact:

Re: FarCmds (FAR Commands)

Post by John Doe »

У данной команды есть одно преимущество, перед аналогичными утилитами ОС: при нехватке прав будет запрос на повышение.
Поэтому есть смысл оставить команду, для использования в UserMenu.

На неё есть определённые нарекания. Но всё можно поправить. Или хотя бы документировать существующие ограничения в справке.
User avatar
Skirda
Posts: 3475
Joined: Wed 16 Mar, 2005 11:01
Been thanked: 8 times

Re: FarCmds (FAR Commands)

Post by Skirda »

Про перехваты выводов.

Запускаем edit:<1|%TEMP%|FileNotFound (FileNotFound - имя несуществующего файла, перехватываем только stdout)

Результат:
1. артефакты на экране перед появлением редактора (здесь stderr выплюнулся на экран)
2. пустой редактор (что верно, т.к. в stdout ничего не попало)

Вопрос.
Что понимается под фразой "перехватывать только стандартный поток вывода stdout" (касаемо только озвученного выше примера):
"stdout перехватить в файл, stderr выплюнуть на экран"
или
"stdout перехватить в файл, stderr не показывать на экране (показывать только если указан mode '<' или '+')"
?
We are the Borg. You will be assimilated.
So Say We All!
User avatar
John Doe
Бюрократ
Posts: 13862
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 74 times
Been thanked: 428 times
Contact:

Re: FarCmds (FAR Commands)

Post by John Doe »

Полагаю задумано stderr не показывать на экране.
Если бы мы хотели его видеть, то перехватывали бы его.
Post Reply

Return to “Обсуждение плагинов”