Skip to content
Snippets Groups Projects
Commit b8e0aab7 authored by Moul's avatar Moul
Browse files

[mod] #328: license: Import complete click module

parent 0339771a
No related branches found
No related tags found
1 merge request!181Ğ1 monetary license update and license handling refactoring
...@@ -13,22 +13,21 @@ ...@@ -13,22 +13,21 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with Silkaj. If not, see <https://www.gnu.org/licenses/>. # along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
import click
import webbrowser import webbrowser
from click import command, confirm, echo_via_pager
def license_approval(currency): def license_approval(currency):
if currency != "g1": if currency != "g1":
return return
if confirm( if click.confirm(
"You will be asked to approve Ğ1 license. Would you like to display it?" "You will be asked to approve Ğ1 license. Would you like to display it?"
): ):
display_license() display_license()
confirm("Do you approve Ğ1 license?", abort=True) click.confirm("Do you approve Ğ1 license?", abort=True)
@command("license", help="Display Ğ1 license") @click.command("license", help="Display Ğ1 license")
def license_command(): def license_command():
display_license() display_license()
...@@ -37,7 +36,7 @@ def display_license(): ...@@ -37,7 +36,7 @@ def display_license():
language = input("In which language would you like to display Ğ1 license [en/fr]? ") language = input("In which language would you like to display Ğ1 license [en/fr]? ")
if language == "en": if language == "en":
if not webbrowser.open("https://duniter.org/en/wiki/g1-license/"): if not webbrowser.open("https://duniter.org/en/wiki/g1-license/"):
echo_via_pager(open("licence-G1/license/license_g1-en.rst").read()) click.echo_via_pager(open("licence-G1/license/license_g1-en.rst").read())
else: else:
if not webbrowser.open("https://duniter.org/fr/wiki/licence-g1/"): if not webbrowser.open("https://duniter.org/fr/wiki/licence-g1/"):
echo_via_pager(open("licence-G1/license/license_g1-fr-FR.rst").read()) click.echo_via_pager(open("licence-G1/license/license_g1-fr-FR.rst").read())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment