#1106 frontend: adds missing help for some commands and also shell command
Merged 4 years ago by praiskup. Opened 4 years ago by thrnciar.

@@ -8,6 +8,9 @@ 

  @click.option('--proven/--no-proven', default=False)

  @click.option('--proxy/--no-proxy', default=False)

  def alter_user(name, admin, proven, proxy):

+     """

+     Alter user data

+     """

      user = models.User.query.filter(

          models.User.username == name).first()

      if not user:

@@ -4,9 +4,6 @@ 

  import click

  

  

- """

- Create the DB schema

- """

  @click.command()

  @click.option(

      "--alembic", "-f", "alembic_ini",
@@ -14,6 +11,9 @@ 

      required=True

  )

  def create_db(alembic_ini):

+     """

+     Create the DB schema

+     """

      create_sqlite_file_function()

      db.create_all()

      # load the Alembic configuration and generate the

@@ -3,11 +3,6 @@ 

  import click

  

  

- """

- Create the sqlite DB file (not the tables).

- Used for alembic, "create-db" does this automatically.

- """

- 

  def create_sqlite_file_function():

      if flask.current_app.config["SQLALCHEMY_DATABASE_URI"].startswith("sqlite"):

          # strip sqlite:///
@@ -18,4 +13,8 @@ 

  

  @click.command()

  def create_sqlite_file():

+     """

+     Create the sqlite DB file (not the tables).

+     Used for alembic, "create-db" does this automatically.

+     """

      return create_sqlite_file()

@@ -2,10 +2,9 @@ 

  import click

  

  

- """

- Delete DB

- """

- 

  @click.command()

  def drop_db():

+     """

+     Delete DB

+     """

      db.drop_all()

@@ -5,6 +5,9 @@ 

  @click.command()

  @click.argument("username")

  def dump_user(username):

+     """

+     Dump user

+     """

      user = models.User.query.filter(models.User.username == username).first()

      if not user:

          print("There is no user named {0}.".format(username))

@@ -3,5 +3,8 @@ 

  

  @click.command()

  def get_admins():

+     """

+     Display list of admins

+     """

      for u in models.User.query.filter(models.User.admin == True).all():

          print(u.username)

@@ -19,6 +19,9 @@ 

      required=True

  )

  def rawhide_to_release(rawhide_chroot, dest_chroot):

+     """

+     Branching

+     """

      mock_chroot = coprs_logic.MockChrootsLogic.get_from_name(dest_chroot).first()

      if not mock_chroot:

          print("Given chroot does not exist. Please run:")

@@ -12,6 +12,9 @@ 

  )

  

  def test(coverage, arguments):

+     """

+     Runs tests

+     """

      os.environ["COPRS_ENVIRON_UNITTEST"] = "1"

      if not (("COPR_CONFIG" in os.environ) and os.environ["COPR_CONFIG"]):

          os.environ["COPR_CONFIG"] = "/etc/copr/copr_unit_test.conf"

Could we use else: function(args, ctx.info_name)?

rebased onto a6b94a6939249c6f38c125d2cfd1e02ce54f72b4

4 years ago

OK, then this should be merged first, right?

yes, that's correct

Is this adding or removing end of file newline :-)

rebased onto 8f544495d468fb570c530b2a361942cbc0cbd7ad

4 years ago

Sorry, I eventually merged the other PR, because it was 24h+ to not wait another day with reorder.

This is uber-complicated. I would rather add those three commands just normally.

I know, I should make my god damn mind :D. The thing is, the refactorization we made in the previous PR allowed us to just throw away 90% of the text and focus just on the list of command names.

In this case, we are adding complexity, that doesn't help us with anything, really. I would prefer to add those flask commands outside of the for loop.

Agreed, can we ten concentrate on the documentation part in this pull-request, and cosider
https://pagure.io/copr/copr/pull-request/1107 as complement? That one adds nicer help
output (for both ./manage.py and ./manage run --help), returns correct exit status, and
hides the compat runserver command from help.

rebased onto 0e3cc14

4 years ago

Commit 36e2ac6 fixes this pull-request

Pull-Request has been merged by praiskup

4 years ago