Добавлено определение путей до внешних программ при подключении к редактору.
This commit is contained in:
23
README.md
23
README.md
@@ -158,6 +158,29 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
|
||||
- Alt-S - Split the edited window horizontally
|
||||
- Alt-K - Open folder
|
||||
|
||||
### Work with external tools
|
||||
ProjMan allows you to connect any external tools to the editor. To do this, you need to add an entry to the file ~/.config/projman/tools.ini.
|
||||
|
||||
Calling an external program is available through the main and pop-up menus. To transfer the parameters, write the appropriate template in the file.
|
||||
- %s - template for substituting selected text in the editor
|
||||
- %f - template for substituting selected file\(s\) in the file tree
|
||||
|
||||
When adding multiple %f templates, the corresponding number of files allocated in the tree will be substituted.
|
||||
|
||||
```
|
||||
[TkDIFF]
|
||||
commandString=tkdiff %f %f
|
||||
description=TkDiff is a Tcl/Tk front-end to diff
|
||||
icon=
|
||||
shortCut=
|
||||
|
||||
[VisualRegexp]
|
||||
commandString=tkregexp "%s"
|
||||
description=A graphical front-end to write/debug regular expression
|
||||
icon=
|
||||
shortCut=
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Sergey Kalinin - author
|
||||
|
||||
11
debian/changelog
vendored
11
debian/changelog
vendored
@@ -1,3 +1,14 @@
|
||||
projman (2.0.0-beta2) stable; urgency=medium
|
||||
|
||||
* Сделана обработка шаблонов командной строки и запуск внешних инструментов.
|
||||
* Добавлен tkregexp для установки в /usr/bin
|
||||
* Начало работы с внешними инструментами: - Добавлено создание и работа (проверка параметров
|
||||
* Исправлен скрипт сборки бсд-пакета
|
||||
* Добавлена сборка пакетов для openbsd
|
||||
* Релиз 1-й бета версии
|
||||
|
||||
-- svk <svk@nuk-svk.ru> Thu, 22 Jan 2026 17:58:15 +0300
|
||||
|
||||
projman (2.0.0-beta1) stable; urgency=medium
|
||||
|
||||
* Сделан вывод отладочной информации по запросу.
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace eval Tools {} {
|
||||
}
|
||||
|
||||
set ::toolsDefault "\[VisualRegexp\]
|
||||
commandString=tkregexp %s
|
||||
description'A graphical front-end to write/debug regular expression
|
||||
commandString=tkregexp \"%s\"
|
||||
description=A graphical front-end to write/debug regular expression
|
||||
icon=
|
||||
shortCut=
|
||||
\[TkDIFF\]
|
||||
@@ -124,6 +124,28 @@ proc Tools::GetMenu {m} {
|
||||
}
|
||||
}
|
||||
|
||||
proc Tools::CommandPathSettings {command} {
|
||||
global tcl_platform
|
||||
if [file exists $command] {return $command}
|
||||
|
||||
if {$tcl_platform(platform) eq "windows"} {
|
||||
set cmd "where $command)"
|
||||
} else {
|
||||
set cmd "which $command"
|
||||
}
|
||||
DebugPuts [catch {exec {*}$cmd} toolsPath]
|
||||
DebugPuts "executor_path $toolsPath"
|
||||
if {[catch {exec {*}$cmd} toolsPath]} {
|
||||
DebugPuts "Программа $command не найдена в системе"
|
||||
return ""
|
||||
}
|
||||
set fullPath [string trim $toolsPath]
|
||||
set firstPath [lindex [split $toolsPath "\n"] 0]
|
||||
|
||||
DebugPuts "Tools::CommandPathSettings: executable path $fullPath"
|
||||
return $fullPath
|
||||
}
|
||||
|
||||
proc Tools::Execute {toolName} {
|
||||
global cfgVariables toolsVariables tree
|
||||
if ![dict exists $::toolsVariables $toolName commandString] {
|
||||
@@ -133,13 +155,22 @@ proc Tools::Execute {toolName} {
|
||||
set command [dict get $::toolsVariables $toolName commandString]
|
||||
DebugPuts "Tools::Execute: command for $toolName as $command"
|
||||
}
|
||||
|
||||
set fullCommand $command
|
||||
|
||||
# 7. Проверять команды на доступность в системе и подставлять полный путь к команде
|
||||
# если в конфиге не указан полный путь.
|
||||
# Проверем наличие внешгних программ в системе
|
||||
set cmd [lindex [split $command " "] 0]
|
||||
if [file exists $cmd] {
|
||||
set fullCommand $command
|
||||
} else {
|
||||
set fullPathToExec [Tools::CommandPathSettings "$cmd"]
|
||||
set fullCommand [lreplace [split $command " "] 0 0 $fullPathToExec]
|
||||
}
|
||||
DebugPuts "Tools::Execute: $fullPathToExec, $fullCommand"
|
||||
# 2. Определять выделен ли текст в открытом редакторе
|
||||
# 5. Заменяем %s на выделенный в редакторе текст
|
||||
set selectedText [Editor::SelectionGet]
|
||||
if {$selectedText ne ""} {
|
||||
regsub -all "%s" $command "$selectedText" fullCommand
|
||||
regsub -all "%s" $fullCommand "$selectedText" fullCommand
|
||||
DebugPuts "Tools::Execute: selected text \"$selectedText\", command \"$fullCommand\""
|
||||
}
|
||||
|
||||
@@ -154,14 +185,12 @@ proc Tools::Execute {toolName} {
|
||||
if {![string match "*%f*" $fullCommand]} break
|
||||
set fullCommand [regsub {%f} $fullCommand $file]
|
||||
}
|
||||
DebugPuts "Tools::Execute: $fullCommand"
|
||||
}
|
||||
|
||||
# 5. Заменяем %s на выделенный в редакторе текст
|
||||
# 6. Заменяем %d на текущий каталог(и), если он выделен в дереве,
|
||||
# и если не выделено то корневой открытый в дереве
|
||||
# 7. Проверять команды на доступность в системе и подставлять полный путь к команде
|
||||
# если в конфиге не указан полный путь.
|
||||
DebugPuts "Tools::Execute: $fullCommand"
|
||||
|
||||
set pipe [open "|$fullCommand" "r"]
|
||||
fileevent $pipe readable
|
||||
fconfigure $pipe -buffering none -blocking no
|
||||
|
||||
@@ -9,8 +9,8 @@ exec wish8.6 "$0" -- "$@"
|
||||
# Home page: https://nuk-svk.ru
|
||||
######################################################
|
||||
# Version: 2.0.0
|
||||
# Release: beta1
|
||||
# Build: 22012026174911
|
||||
# Release: beta2
|
||||
# Build: 27012026142407
|
||||
######################################################
|
||||
|
||||
# определим текущую версию, релиз и т.д.
|
||||
|
||||
Reference in New Issue
Block a user