Compare commits

..

No commits in common. "df046bb07188c4197355c14a7069d57e1d477cc9" and "39c840cd74ed3faa795ebdf71cc31bdab6ca23ee" have entirely different histories.

4 changed files with 10 additions and 82 deletions

View File

@ -1,6 +1,8 @@
# target_compile_features has been introduced in that version
cmake_minimum_required (VERSION 3.1)
project (sdn VERSION 0.1 LANGUAGES CXX)
cmake_minimum_required (VERSION 3.1.0)
project (sdn CXX)
set (version 0.1)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
@ -21,25 +23,25 @@ target_include_directories (${PROJECT_NAME} PUBLIC ${NCURSESW_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} PUBLIC ${NCURSESW_LIBRARIES} acl)
target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_14)
target_compile_definitions (${PROJECT_NAME} PUBLIC
-DPROJECT_NAME=\"${PROJECT_NAME}\" -DPROJECT_VERSION=\"${PROJECT_VERSION}\")
-DPROJECT_NAME=\"${PROJECT_NAME}\" -DPROJECT_VERSION=\"${version}\")
include (GNUInstallDirs)
install (TARGETS ${PROJECT_NAME} 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})
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Directory navigator")
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION ${version})
set (CPACK_GENERATOR "TGZ;ZIP")
set (CPACK_PACKAGE_FILE_NAME
"${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_VERSION}")
"${PROJECT_NAME}-${version}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${version}")
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${version}")
set (CPACK_SET_DESTDIR TRUE)
include (CPack)

View File

@ -1,30 +0,0 @@
.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
View File

@ -1,38 +0,0 @@
.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

View File

@ -423,8 +423,7 @@ static const char *g_action_names[] = {ACTIONS(XX)};
static map<wint_t, action> g_normal_actions {
{ALT | '\r', ACTION_CHOOSE_FULL}, {ALT | KEY (ENTER), ACTION_CHOOSE_FULL},
{'\r', ACTION_CHOOSE}, {KEY (ENTER), ACTION_CHOOSE},
{KEY (F (1)), ACTION_HELP}, {'h', ACTION_HELP},
{KEY (F (3)), ACTION_VIEW}, {KEY (F (4)), ACTION_EDIT},
{KEY (F (3)), ACTION_VIEW}, {KEY (F (4)), ACTION_EDIT}, {'h', ACTION_HELP},
{'q', ACTION_QUIT}, {ALT | 'q', ACTION_QUIT_NO_CHDIR},
// M-o ought to be the same shortcut the navigator is launched with
{ALT | 'o', ACTION_QUIT},
@ -1720,11 +1719,6 @@ fun save_config () {
}
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,
// since then it redirects stdin to /dev/null
(void) close (STDIN_FILENO);