libtracefs: Add trace_sql.bash for tracefs_sql() bash completions
Subsystems (2)
PATCH v4 1/1 libtracefs: Add trace_sql.bash for tracefs_sql() bash completions
From: "Steven Rostedt (Google)" <[email protected]>
trace-cmd and the internal sqlhist programs can take SQL input to be passed into the tracefs_sql() function. This can be a bit complex, so create a bash completion script that uses trace-cmd to allow for tab completions on a bash command line to fill in the next commands.
This should simplify creating bash completions as well as make some shortcuts known.
Other completions can include this file and use tracefs_sql_completion() function.
---
Changes since v3: https://lore.kernel.org/[email protected]
- Have "make install" place the completion in /usr/share/bash-completion/completions/ Just like it does for "make meson_install"
Makefile | 12 +- meson.build | 1 + scripts/utils.mk | 8 + src/meson.build | 4 + src/tracefs_sql.bash | 366 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 385 insertions(+), 6 deletions(-) create mode 100644 src/tracefs_sql.bash
Makefile +6 -6
@@ -55,6 +55,8 @@ libdir_relative ?= $(libdir_relative_temp) prefix ?= /usr/local man_dir ?= $(prefix)/share/man man_dir_SQ = '$(subst ','\'',$(man_dir))' +completion_dir ?= $(prefix)/share/bash-completion/completions +completion_dir_SQ = '$(subst ','\'',$(completion_dir))' libdir ?= $(prefix)/$(libdir_relative) libdir_SQ = '$(subst ','\'',$(libdir))' includedir_relative ?= include/tracefs
@@ -86,9 +88,6 @@ else PREF_DEFINED := 0 endif -etcdir ?= /etc -etcdir_SQ = '$(subst ','\'',$(etcdir))' - export man_dir man_dir_SQ html_install html_install_SQ INSTALL export img_install img_install_SQ export DESTDIR DESTDIR_SQ
@@ -100,8 +99,6 @@ HELP_DIR = -DHELP_DIR=$(html_install) HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))' #' emacs highlighting gets confused by the above escaped quote. -BASH_COMPLETE_DIR ?= $(etcdir)/bash_completion.d - # copy a bit from Linux kbuild ifeq ("$(origin V)", "command line")
@@ -300,7 +297,10 @@ install_libs: libs install_pkgconfig $(Q)$(call do_install,$(src)/include/tracefs.h,$(includedir_SQ),644) $(Q)$(call install_ld_config) -install: install_libs +install_bash_completion: force + $(Q)$(call do_install_data,$(src)/src/tracefs_sql.bash,$(completion_dir)) + +install: install_libs install_bash_completion install_pkgconfig: $(PKG_CONFIG_FILE) $(Q)$(call , $(PKG_CONFIG_FILE)) \
meson.build +1 -0
@@ -21,6 +21,7 @@ threads_dep = dependency('threads', required: true) cunit_dep = dependency('cunit', required : false) prefixdir = get_option('prefix') +datadir = join_paths(prefixdir, get_option('datadir')) bindir = join_paths(prefixdir, get_option('bindir')) mandir = join_paths(prefixdir, get_option('mandir')) htmldir = join_paths(prefixdir, get_option('htmldir'))
scripts/utils.mk +8 -0
@@ -187,6 +187,14 @@ define do_install $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2' endef +define do_install_data + $(print_install) \ + if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + fi; \ + $(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2' +endef + define do_install_pkgconfig_file if [ -n "${pkgconfig_dir}" ]; then \ $(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); \
src/meson.build +4 -0
@@ -63,3 +63,7 @@ pkg.generate( libtracefs_dep = declare_dependency( include_directories: ['.'], link_with: libtracefs) + +install_data( + 'tracefs_sql.bash', + install_dir: datadir + '/bash-completion/completions')
src/tracefs_sql.bash new file +366 -0
366 lines not on this page · raw message
Signature · 1 line
2.47.2