Skip to content

Commit

Permalink
Add manpages to data/release/man
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0d committed Jan 3, 2025
1 parent 119a35b commit 17de503
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 22 deletions.
8 changes: 1 addition & 7 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ upstream_package_name: command-line-assistant
downstream_package_name: command-line-assistant
upstream_project_url: https://github.com/rhel-lightspeed/command-line-assistant

srpm_build_deps:
- python3-pip
- python3-dasbus
- python3-requests
- make
srpm_build_deps: []

jobs:
# Build RPMs for each pull request
Expand All @@ -21,8 +17,6 @@ jobs:
- epel-9-aarch64
- epel-10-aarch64
actions:
post-upstream-clone:
- bash -c "cd docs; pip install -r requirements.txt; SPHINXBUILD=/builddir/.local/bin/sphinx-build make man"
# do not get the version from a tag (git describe) but from the spec file
get-current-version:
- grep -oP '^Version:\s+\K\S+' packaging/command-line-assistant.spec
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
unlink-systemd-units \
run-clad status-clad \
reload-clad \
manpages \

# Project directory path - /home/<user>/.../command-line-assistant
PROJECT_DIR := $(shell pwd)
Expand Down Expand Up @@ -80,6 +81,7 @@ clean: ## Clean project files
.tox \
junit.xml \
coverage.xml
$(MAKE) -C docs clean

link-systemd-units: ## Link the systemd units to ~/.config/systemd/user
@echo "Linking the systemd units from $(CLAD_SYSTEMD_DEVEL_PATH) to $(SYSTEMD_USER_UNITS)/clad.service"
Expand All @@ -105,3 +107,8 @@ status-clad: ## Check the status for clad
reload-clad: ## Reload clad systemd unit
@systemctl --user daemon-reload
@systemctl restart --user clad

man: ## Build manpages
# Build the manpages and change the builddir to match data/release
# Also change the doctrees cache to still use the original build directory.
$(MAKE) BUILDDIR=../data/release SPHINXOPTS=-d=build -C docs man
137 changes: 137 additions & 0 deletions data/release/man/c.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "C" "1" "Jan 03, 2025" "0.1.0" "Command Line Assistant"
.SH NAME
c \- Command Line Assistant Client
.sp
A script with multiple optional arguments and a required positional argument if no optional arguments are provided.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
c [\-h] [\-\-version] {query,history,record} ...
.EE
.UNINDENT
.UNINDENT
.SH C OPTIONS
.INDENT 0.0
.IP \(bu 2
\fI\%\-h\fP, \fI\%\-\-help\fP \- show this help message and exit
.IP \(bu 2
\fI\%\-\-version\fP \- Show command line assistant version and exit.
.UNINDENT
.SH C QUERY
.sp
Ask a question and get an answer from LLM.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
c query [\-h] [query_string]
.EE
.UNINDENT
.UNINDENT
.SS c query positional arguments
.INDENT 0.0
.IP \(bu 2
\fI\%query_string\fP \- Query string to be processed. (default: \fBNone\fP)
.UNINDENT
.SS c query options
.INDENT 0.0
.IP \(bu 2
\fI\%\-h\fP, \fI\%\-\-help\fP \- show this help message and exit
.UNINDENT
.SH C HISTORY
.sp
Manage conversation history
.INDENT 0.0
.INDENT 3.5
.sp
.EX
c history [\-h] [\-\-clear] [\-\-first] [\-\-last]
.EE
.UNINDENT
.UNINDENT
.SS c history options
.INDENT 0.0
.IP \(bu 2
\fI\%\-h\fP, \fI\%\-\-help\fP \- show this help message and exit
.IP \(bu 2
\fI\%\-\-clear\fP \- Clear the history.
.IP \(bu 2
\fI\%\-\-first\fP \- Get the first conversation from history.
.IP \(bu 2
\fI\%\-\-last\fP \- Get the last conversation from history.
.UNINDENT
.SH C RECORD
.sp
Start a recording session for script output.
.INDENT 0.0
.INDENT 3.5
.sp
.EX
c record [\-h] [\-\-output\-file OUTPUT_FILE]
.EE
.UNINDENT
.UNINDENT
.SS c record options
.INDENT 0.0
.IP \(bu 2
\fI\%\-h\fP, \fI\%\-\-help\fP \- show this help message and exit
.IP \(bu 2
\fI\%\-\-output\-file\fP \fBOUTPUT_FILE\fP \- The place where to store the output file. (default: \fBNone\fP)
.UNINDENT
.INDENT 0.0
.TP
.B Asking a question:
$ c query \(dqHow do I check disk space?\(dq
.sp
$ c \(dqHow do I check disk space?\(dq
.TP
.B Check all history entries:
$ c history
.TP
.B Check the first entry:
$ c history \-\-first
.TP
.B Check the last entry:
$ c history \-\-last
.TP
.B Clear all the history entries:
$ c history \-\-clear
.UNINDENT
.sp
\fBclad(8)\fP
.SH AUTHOR
RHEL Lightspeed Team
.SH COPYRIGHT
2024, RHEL Lightspeed Team
.\" Generated by docutils manpage writer.
.
56 changes: 56 additions & 0 deletions data/release/man/clad.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "CLAD" "8" "Jan 03, 2025" "0.1.0" "Command Line Assistant"
.SH NAME
clad \- Command Line Assistant Daemon
.SH SYNOPSIS
.sp
\fBclad\fP
.SH DESCRIPTION
.sp
The Command Line Assistant daemon (clad) provides the backend service for processing queries through D\-Bus.
.SH FILES
.INDENT 0.0
.TP
.B \fI/etc/xdg/command\-line\-assistant/config.toml\fP
System configuration file
.TP
.B \fI/var/lib/command\-line\-assistant/history.json\fP
History storage file
.UNINDENT
.SH SEE ALSO
.sp
\fBc(1)\fP
.SH AUTHOR
RHEL Lightspeed Team
.SH COPYRIGHT
2024, RHEL Lightspeed Team
.\" Generated by docutils manpage writer.
.
29 changes: 14 additions & 15 deletions packaging/command-line-assistant.spec
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ A simple wrapper to interact with RAG
%install
%py3_install_wheel %{python_package_src}-%{version}-py3-none-any.whl

# Create sbin directory in buildroot
# Create needed directories in buildroot
%{__install} -d %{buildroot}/%{_sbindir}
%{__install} -d %{buildroot}/%{_sysconfdir}/xdg/%{python_package_src}
%{__install} -d %{buildroot}/%{_sharedstatedir}/%{name}
%{__install} -d %{buildroot}/%{_mandir}/man1
%{__install} -d %{buildroot}/%{_mandir}/man8

# Move the daemon to /usr/sbin instead of /usr/bin
%{__install} -m 0755 %{buildroot}/%{_bindir}/%{daemon_binary_name} %{buildroot}/%{_sbindir}/%{daemon_binary_name}
Expand All @@ -61,19 +64,11 @@ A simple wrapper to interact with RAG
%{__install} -D -m 0644 data/release/xdg/config.toml %{buildroot}/%{_sysconfdir}/xdg/%{python_package_src}/config.toml

# History file
## Create the folder under /var/lib/command-line-assistant
%{__install} -d %{buildroot}/%{_sharedstatedir}/%{name}
## Place the history file there
%{__install} -D -m 0644 data/release/xdg/history.json %{buildroot}/%{_sharedstatedir}/%{name}/history.json

# Manpages
## Create directories for man1 and man8
%{__install} -d -m 755 %{buildroot}%{_mandir}/man1
%{__install} -d -m 755 %{buildroot}%{_mandir}/man8

# Install the man1 and man8 for cla(d)
%{__install} -p docs/build/man/%{binary_name}.1 %{buildroot}%{_mandir}/man1/%{binary_name}.1
%{__install} -p docs/build/man/%{daemon_binary_name}.8 %{buildroot}%{_mandir}/man8/%{daemon_binary_name}.8
%{__install} -D -m 0644 data/release/man/%{binary_name}.1 %{buildroot}/%{_mandir}/man1/%{binary_name}.1
%{__install} -D -m 0644 data/release/man/%{daemon_binary_name}.8 %{buildroot}/%{_mandir}/man8/%{daemon_binary_name}.8

%post
%systemd_post %{daemon_binary_name}.service
Expand All @@ -84,9 +79,13 @@ A simple wrapper to interact with RAG
%postun
%systemd_postun_with_restart %{daemon_binary_name}.service

%doc
README.md

%license
LICENSE

%files
%doc README.md
%license LICENSE
%{python3_sitelib}/%{python_package_src}/
%{python3_sitelib}/%{python_package_src}-%{version}.dist-info/

Expand All @@ -109,7 +108,7 @@ A simple wrapper to interact with RAG
%{_sharedstatedir}/%{name}/history.json

# Manpages
%attr(0644,root,root) %{_mandir}/man1/%{binary_name}.1
%attr(0644,root,root) %{_mandir}/man8/%{daemon_binary_name}.8
%{_mandir}/man1/%{binary_name}.1.gz
%{_mandir}/man8/%{daemon_binary_name}.8.gz

%changelog

0 comments on commit 17de503

Please sign in to comment.