Compare commits
4 Commits
39c840cd74
...
df046bb071
Author | SHA1 | Date | |
---|---|---|---|
df046bb071 | |||
0c1a8d9902 | |||
cc59fcfb41 | |||
c88566e7bb |
@ -1,8 +1,6 @@
|
|||||||
# target_compile_features has been introduced in that version
|
# target_compile_features has been introduced in that version
|
||||||
cmake_minimum_required (VERSION 3.1.0)
|
cmake_minimum_required (VERSION 3.1)
|
||||||
|
project (sdn VERSION 0.1 LANGUAGES CXX)
|
||||||
project (sdn CXX)
|
|
||||||
set (version 0.1)
|
|
||||||
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
|
||||||
@ -23,25 +21,25 @@ target_include_directories (${PROJECT_NAME} PUBLIC ${NCURSESW_INCLUDE_DIRS})
|
|||||||
target_link_libraries (${PROJECT_NAME} PUBLIC ${NCURSESW_LIBRARIES} acl)
|
target_link_libraries (${PROJECT_NAME} PUBLIC ${NCURSESW_LIBRARIES} acl)
|
||||||
target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_14)
|
target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_14)
|
||||||
target_compile_definitions (${PROJECT_NAME} PUBLIC
|
target_compile_definitions (${PROJECT_NAME} PUBLIC
|
||||||
-DPROJECT_NAME=\"${PROJECT_NAME}\" -DPROJECT_VERSION=\"${version}\")
|
-DPROJECT_NAME=\"${PROJECT_NAME}\" -DPROJECT_VERSION=\"${PROJECT_VERSION}\")
|
||||||
|
|
||||||
include (GNUInstallDirs)
|
include (GNUInstallDirs)
|
||||||
install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
install (PROGRAMS ${PROJECT_NAME}-install DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install (PROGRAMS ${PROJECT_NAME}-install DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
install (FILES sdn.1 sdn-install.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||||
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||||
|
|
||||||
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Directory navigator")
|
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Directory navigator")
|
||||||
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
|
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
|
||||||
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
|
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
|
||||||
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||||
set (CPACK_PACKAGE_VERSION ${version})
|
|
||||||
set (CPACK_GENERATOR "TGZ;ZIP")
|
set (CPACK_GENERATOR "TGZ;ZIP")
|
||||||
set (CPACK_PACKAGE_FILE_NAME
|
set (CPACK_PACKAGE_FILE_NAME
|
||||||
"${PROJECT_NAME}-${version}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
"${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${version}")
|
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_VERSION}")
|
||||||
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
|
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
|
||||||
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
|
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
|
||||||
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${version}")
|
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
|
||||||
|
|
||||||
set (CPACK_SET_DESTDIR TRUE)
|
set (CPACK_SET_DESTDIR TRUE)
|
||||||
include (CPack)
|
include (CPack)
|
||||||
|
30
sdn-install.1
Normal file
30
sdn-install.1
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
.Dd October 26, 2020
|
||||||
|
.Dt SDN-INSTALL 1
|
||||||
|
.Os Linux
|
||||||
|
.Sh NAME
|
||||||
|
.Nm sdn-install
|
||||||
|
.Nd integrate sdn with the shell
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm sdn-install
|
||||||
|
.Op Fl s Ar shell
|
||||||
|
.Op Fl p Ar - | rcpath
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
integrates
|
||||||
|
.Xr sdn 1
|
||||||
|
with your shell, binding it to M-o. If the navigator has already been
|
||||||
|
integrated, it updates the snippet in-place.
|
||||||
|
.Pp
|
||||||
|
The options are as follows:
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Fl p Ar -
|
||||||
|
Merely print the integration snippet for the appropriate shell to the standard
|
||||||
|
output, not changing anything.
|
||||||
|
.It Fl p Ar rcpath
|
||||||
|
Install the integration snippet into a different shell initialization file than
|
||||||
|
your user's default one.
|
||||||
|
.It Fl s Ar shell
|
||||||
|
If you want to integrate
|
||||||
|
.Xr sdn 1
|
||||||
|
with a different shell than you're running, use this option to specify it.
|
||||||
|
.El
|
38
sdn.1
Normal file
38
sdn.1
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
.Dd October 26, 2020
|
||||||
|
.Dt SDN 1
|
||||||
|
.Os Linux
|
||||||
|
.Sh NAME
|
||||||
|
.Nm sdn
|
||||||
|
.Nd simple directory navigator
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm sdn
|
||||||
|
.Op Ar line Ar point
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
is a simple directory navigator that you can invoke while editing shell
|
||||||
|
commands. Use the
|
||||||
|
.Xr sdn-install 1
|
||||||
|
script to integrate it with your shell, then invoke it with M-o.
|
||||||
|
.Sh ENVIRONMENT
|
||||||
|
.Bl -tag -width 15n
|
||||||
|
.It Ev LS_COLORS
|
||||||
|
Used to retrieve filename colours. The format is described in
|
||||||
|
.Xr dir_colors 5
|
||||||
|
and you can use the
|
||||||
|
.Xr dircolors 1
|
||||||
|
utility to initialize this variable.
|
||||||
|
.It Ev PAGER
|
||||||
|
The viewer program to be launched by the F3 key binding as well as to show
|
||||||
|
the internal help message.
|
||||||
|
.It Ev VISUAL , Ev EDITOR
|
||||||
|
The editor program to be launched by the F4 key binding.
|
||||||
|
.El
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -tag -width 25n -compact
|
||||||
|
.It Pa ~/.config/sdn/config
|
||||||
|
Program configuration and state.
|
||||||
|
.It Pa ~/.config/sdn/bindings
|
||||||
|
Key binding overrides.
|
||||||
|
.It Pa ~/.config/sdn/look
|
||||||
|
Redefine terminal attributes for UI elements.
|
||||||
|
.El
|
8
sdn.cpp
8
sdn.cpp
@ -423,7 +423,8 @@ static const char *g_action_names[] = {ACTIONS(XX)};
|
|||||||
static map<wint_t, action> g_normal_actions {
|
static map<wint_t, action> g_normal_actions {
|
||||||
{ALT | '\r', ACTION_CHOOSE_FULL}, {ALT | KEY (ENTER), ACTION_CHOOSE_FULL},
|
{ALT | '\r', ACTION_CHOOSE_FULL}, {ALT | KEY (ENTER), ACTION_CHOOSE_FULL},
|
||||||
{'\r', ACTION_CHOOSE}, {KEY (ENTER), ACTION_CHOOSE},
|
{'\r', ACTION_CHOOSE}, {KEY (ENTER), ACTION_CHOOSE},
|
||||||
{KEY (F (3)), ACTION_VIEW}, {KEY (F (4)), ACTION_EDIT}, {'h', ACTION_HELP},
|
{KEY (F (1)), ACTION_HELP}, {'h', ACTION_HELP},
|
||||||
|
{KEY (F (3)), ACTION_VIEW}, {KEY (F (4)), ACTION_EDIT},
|
||||||
{'q', ACTION_QUIT}, {ALT | 'q', ACTION_QUIT_NO_CHDIR},
|
{'q', ACTION_QUIT}, {ALT | 'q', ACTION_QUIT_NO_CHDIR},
|
||||||
// M-o ought to be the same shortcut the navigator is launched with
|
// M-o ought to be the same shortcut the navigator is launched with
|
||||||
{ALT | 'o', ACTION_QUIT},
|
{ALT | 'o', ACTION_QUIT},
|
||||||
@ -1719,6 +1720,11 @@ fun save_config () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char *argv[]) {
|
int main (int argc, char *argv[]) {
|
||||||
|
if (argc == 2 && string (argv[1]) == "--version") {
|
||||||
|
cout << PROJECT_NAME << " " << PROJECT_VERSION << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// zsh before 5.4 may close stdin before exec without redirection,
|
// zsh before 5.4 may close stdin before exec without redirection,
|
||||||
// since then it redirects stdin to /dev/null
|
// since then it redirects stdin to /dev/null
|
||||||
(void) close (STDIN_FILENO);
|
(void) close (STDIN_FILENO);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user