mirror of
https://github.com/wentasah/ros2nix.git
synced 2025-06-09 15:52:23 +03:00
Add shell completion scripts
This commit is contained in:
parent
8528f3558f
commit
0fd819b4a2
2 changed files with 16 additions and 2 deletions
14
flake.nix
14
flake.nix
|
@ -60,14 +60,19 @@
|
||||||
src = pkgs.lib.cleanSource ./.;
|
src = pkgs.lib.cleanSource ./.;
|
||||||
pyproject = true;
|
pyproject = true;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs.python3Packages; [
|
build-system = with pkgs.python3Packages; [
|
||||||
setuptools
|
setuptools
|
||||||
];
|
];
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
installShellFiles
|
||||||
|
python3Packages.argcomplete
|
||||||
|
];
|
||||||
propagatedBuildInputs = with pkgs; [
|
propagatedBuildInputs = with pkgs; [
|
||||||
git
|
git
|
||||||
nix-prefetch-git
|
nix-prefetch-git
|
||||||
nixfmt-rfc-style
|
nixfmt-rfc-style
|
||||||
superflore
|
superflore
|
||||||
|
python3Packages.argcomplete
|
||||||
];
|
];
|
||||||
makeWrapperArgs = [
|
makeWrapperArgs = [
|
||||||
"--set ROS_HOME ${rosdep-cache}"
|
"--set ROS_HOME ${rosdep-cache}"
|
||||||
|
@ -75,6 +80,13 @@
|
||||||
"--set ROSDISTRO_INDEX_URL file://${rosdistro}/index-v4.yaml"
|
"--set ROSDISTRO_INDEX_URL file://${rosdistro}/index-v4.yaml"
|
||||||
"--set ROS_OS_OVERRIDE nixos"
|
"--set ROS_OS_OVERRIDE nixos"
|
||||||
];
|
];
|
||||||
|
postInstall = ''
|
||||||
|
installShellCompletion --cmd ros2nix \
|
||||||
|
--bash <(register-python-argcomplete ros2nix) \
|
||||||
|
--fish <(register-python-argcomplete ros2nix -s fish) \
|
||||||
|
--zsh <(register-python-argcomplete ros2nix -s zsh)
|
||||||
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# PYTHON_ARGCOMPLETE_OK
|
||||||
|
|
||||||
# Copyright 2019-2024 Ben Wolsieffer <benwolsieffer@gmail.com>
|
# Copyright 2019-2024 Ben Wolsieffer <benwolsieffer@gmail.com>
|
||||||
# Copyright 2024 Michal Sojka <michal.sojka@cvut.cz>
|
# Copyright 2024 Michal Sojka <michal.sojka@cvut.cz>
|
||||||
|
|
||||||
import argparse
|
import argcomplete, argparse
|
||||||
import difflib
|
import difflib
|
||||||
import io
|
import io
|
||||||
import itertools
|
import itertools
|
||||||
|
@ -319,6 +320,7 @@ def ros2nix(args):
|
||||||
"--license", help="License of the generated Nix expressions, e.g. 'BSD'"
|
"--license", help="License of the generated Nix expressions, e.g. 'BSD'"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
argcomplete.autocomplete(parser)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.output_dir is None and (args.output_as_nix_pkg_name or args.output_as_ros_pkg_name):
|
if args.output_dir is None and (args.output_as_nix_pkg_name or args.output_as_ros_pkg_name):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue