Skip to content

Commit

Permalink
Merge pull request #49 from yast/fix_help
Browse files Browse the repository at this point in the history
Fix help
  • Loading branch information
jreidinger committed Nov 19, 2020
2 parents 1cc3869 + ba21cf3 commit 0b6a316
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ coverage/
doc/
/.yardoc
/*.pot
/package/*.tar.bz2
7 changes: 7 additions & 0 deletions package/yast2-alternatives.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Nov 18 22:10:43 UTC 2020 - Josef Reidinger <jreidinger@suse.com>

- Handle properly help command for alternatives client
(bsc#1172340)
- 4.3.0

-------------------------------------------------------------------
Thu Jan 16 12:12:09 UTC 2020 - Dominique Leuenberger <dimstar@opensuse.org>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-alternatives.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-alternatives
Version: 4.2.3
Version: 4.3.0
Release: 0
Summary: YaST2 - Manage Update-alternatives switching
License: GPL-2.0-only
Expand Down
31 changes: 31 additions & 0 deletions src/lib/y2_alternatives/client/start_checking_permissions.rb
Expand Up @@ -16,6 +16,7 @@
# To contact SUSE about this file by physical or electronic mail,
# you may find current contact information at www.suse.com

require "yast"
require "y2_alternatives/dialog/list_alternatives"

Yast.import "Confirm"
Expand All @@ -24,9 +25,39 @@ module Y2Alternatives
module Client
# Checks if user is root and create a ListAlternatives dialog
class StartCheckingPermissions
include Yast::I18n

def main
textdomain "alternatives"

if Yast::WFM.Args.include?("help")
print_help
return true
elsif !Yast::WFM.Args.empty?
print_help
return false
end

Dialog::ListAlternatives.run if Yast::Confirm.MustBeRoot
end

private

def print_help
# TRANSLATORS: %s stands for CLI program to use instead of yast module
msg = format(
_("This module does not support command line. Use '%s' instead."),
"update-alternatives"
)

cmdline_description = {
"id" => "alternatives",
"help" => msg
}

Yast.import "CommandLine"
Yast::CommandLine.Run(cmdline_description)
end
end
end
end

0 comments on commit 0b6a316

Please sign in to comment.