# # spec file for package perl-Getopt-Long-Complete # # Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define cpan_name Getopt-Long-Complete Name: perl-Getopt-Long-Complete Version: 0.318.0 Release: 0 # 0.318 -> normalize -> 0.318.0 %define cpan_version 0.318 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Drop-in replacement for Getopt::Long, with shell tab completion URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/P/PE/PERLANCAR/%{cpan_name}-%{cpan_version}.tar.gz Source1: cpanspec.yml Source100: README.md BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Complete::Bash) >= 0.333 BuildRequires: perl(Complete::Fish) BuildRequires: perl(Complete::Getopt::Long) >= 0.481 BuildRequires: perl(Complete::Tcsh) BuildRequires: perl(Complete::Zsh) BuildRequires: perl(Getopt::Long) >= 2.50 BuildRequires: perl(Test::More) >= 0.98 Requires: perl(Complete::Bash) >= 0.333 Requires: perl(Complete::Fish) Requires: perl(Complete::Getopt::Long) >= 0.481 Requires: perl(Complete::Tcsh) Requires: perl(Complete::Zsh) Requires: perl(Getopt::Long) >= 2.50 Provides: perl(Getopt::Long::Complete) = %{version} %undefine __perllib_provides %{perl_requires} %description This module provides a quick and easy way to add shell tab completion feature to your scripts, including scripts already written using the venerable Getopt::Long module. Currently bash and tcsh are directly supported; fish and zsh are also supported via shcompgen. This module is basically just a thin wrapper for Getopt::Long. Its 'GetOptions' function just checks for COMP_LINE/COMP_POINT environment variable (in the case of bash) or COMMAND_LINE (in the case of tcsh) before passing its arguments to 'Getopt::Long''s 'GetOptions'. If those environment variable(s) are defined, completion reply will be printed to STDOUT and then the program will exit. Otherwise, Getopt::Long's GetOptions is called. To keep completion quick, you should do 'GetOptions()' or 'GetOptionsWithCompletion()' as early as possible in your script. Preferably before loading lots of other Perl modules. To activate tab completion in bash, put your script somewhere in 'PATH' and execute this in the shell or put it into your bash startup file (e.g. '/etc/bash.bashrc' or '~/.bashrc'). Replace 'delete-user' with the actual script name: complete -C delete-user delete-user For tcsh: complete delete-user 'p/*/`delete-user`/' For other shells (but actually for bash too) you can use shcompgen. %prep %autosetup -n %{cpan_name}-%{cpan_version} -p1 find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644 %build perl Makefile.PL INSTALLDIRS=vendor %make_build %check make test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %doc Changes README %license LICENSE %changelog