-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL CLI args as "--name value" with new help #3724
Conversation
2f749f9
to
0ec7cd7
Compare
This comment was marked as outdated.
This comment was marked as outdated.
0ec7cd7
to
9e78cc5
Compare
Codecov Report
@@ Coverage Diff @@
## master #3724 +/- ##
==========================================
+ Coverage 82.24% 82.53% +0.28%
==========================================
Files 526 526
Lines 33853 33884 +31
==========================================
+ Hits 27844 27966 +122
+ Misses 6009 5918 -91
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
9e78cc5
to
32ff3ef
Compare
This comment was marked as outdated.
This comment was marked as outdated.
32ff3ef
to
ac5296a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ac5296a
to
51928d4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
51928d4
to
b758546
Compare
This comment was marked as outdated.
This comment was marked as outdated.
b758546
to
7ad6f38
Compare
This comment was marked as outdated.
This comment was marked as outdated.
The arguments were broken into pieces (on spaces), quoted, and finally reassembled by Erlang code. All these steps are now replaced with putting the arguments into an array, whose elements are then passed as arguments. One of the main causes for this change was a bug in arguments concatenation, which was revealed by new command tests.
7ad6f38
to
2ecbc96
Compare
This comment was marked as outdated.
This comment was marked as outdated.
2ecbc96
to
4ea0b35
Compare
This comment was marked as outdated.
This comment was marked as outdated.
420ac4e
to
39dc603
Compare
small_tests_24 / small_tests / 420ac4e small_tests_25 / small_tests / 420ac4e dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 420ac4e ldap_mnesia_24 / ldap_mnesia / 420ac4e dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 420ac4e dynamic_domains_mysql_redis_25 / mysql_redis / 420ac4e ldap_mnesia_25 / ldap_mnesia / 420ac4e dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 420ac4e pgsql_mnesia_24 / pgsql_mnesia / 420ac4e internal_mnesia_25 / internal_mnesia / 420ac4e elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 420ac4e pgsql_mnesia_25 / pgsql_mnesia / 420ac4e mysql_redis_25 / mysql_redis / 420ac4e mssql_mnesia_25 / odbc_mssql_mnesia / 420ac4e riak_mnesia_24 / riak_mnesia / 420ac4e |
small_tests_24 / small_tests / 39dc603 small_tests_25 / small_tests / 39dc603 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 39dc603 ldap_mnesia_24 / ldap_mnesia / 39dc603 dynamic_domains_mysql_redis_25 / mysql_redis / 39dc603 muc_SUITE:hibernation:hibernated_room_can_be_queried_for_archive{error,{{assertion_failed,assert,is_groupchat_message,
[<<"Restorable message">>],
undefined,"undefined"},
[{escalus_new_assert,assert_true,2,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
{line,84}]},
{muc_SUITE,wait_for_mam_result,3,
[{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
{line,4394}]},
{muc_SUITE,'-hibernated_room_can_be_queried_for_archive/1-fun-0-',3,
[{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
{line,4130}]},
{escalus_story,story,4,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,72}]},
{muc_SUITE,hibernated_room_can_be_queried_for_archive,1,
[{file,"/home/circleci/project/big_tests/tests/muc_SUITE.erl"},
{line,4126}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 39dc603 ldap_mnesia_25 / ldap_mnesia / 39dc603 pgsql_mnesia_24 / pgsql_mnesia / 39dc603 dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 39dc603 internal_mnesia_25 / internal_mnesia / 39dc603 elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 39dc603 pgsql_mnesia_25 / pgsql_mnesia / 39dc603 mysql_redis_25 / mysql_redis / 39dc603 riak_mnesia_24 / riak_mnesia / 39dc603 mssql_mnesia_25 / odbc_mssql_mnesia / 39dc603 pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription{error,
{{badmatch,
[{xmlel,<<"message">>,
[{<<"from">>,
<<"alice_unsubscribe_after_presence_unsubscription_2272@localhost">>},
{<<"to">>,
<<"bob_unsubscribe_after_presence_unsubscription_2272@localhost/res1">>},
{<<"type">>,<<"headline">>}],
[{xmlel,<<"event">>,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}],
[{xmlel,<<"items">>,
[{<<"node">>,<<"gfTWV5nlDWqxJ8d9yKCGJg==">>}],
[{xmlel,<<"item">>,
[{<<"id">>,<<"salmon">>}],
[{xmlel,<<"entry">>,
[{<<"xmlns">>,
<<"http://www.w3.org/2005/Atom">>}],
[]}]}]}]},
{xmlel,<<"headers">>,
[{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
[]}]}]},
[{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
[{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
{line,384}]},
{escalus_story,story,4,
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,72}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} dynamic_domains_mysql_redis_25 / mysql_redis / 39dc603 |
39dc603
to
5701808
Compare
small_tests_24 / small_tests / 5701808 small_tests_25 / small_tests / 5701808 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 5701808 ldap_mnesia_24 / ldap_mnesia / 5701808 dynamic_domains_mysql_redis_25 / mysql_redis / 5701808 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 5701808 ldap_mnesia_25 / ldap_mnesia / 5701808 dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 5701808 pgsql_mnesia_24 / pgsql_mnesia / 5701808 internal_mnesia_25 / internal_mnesia / 5701808 elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 5701808 mysql_redis_25 / mysql_redis / 5701808 mam_SUITE:rdbms_async_pool_impl_specific:init_per_group{'EXIT',
{{badrpc,
{'EXIT',
{{start_child_failed,
{error,
{{shutdown,
{failed_to_start_child,pm_mam_async_pool_localhost,
{shutdown,
{failed_to_start_child,
'wpool_pool-pm_mam_async_pool_localhost-process-sup',
{shutdown,
{failed_to_start_child,
'wpool_pool-pm_mam_async_pool_localhost-13',
{already_started,<9154.6327.1>}}}}}}},
{child,undefined,pm_mam_sup_async_pool_localhost,
{mongoose_async_pools,start_link,
[<<"localhost">>,pm_mam,
#{batch_name => insert_mam_messages30,batch_size => 30,
enabled => true,
flush_callback => fun mod_mam_rdbms_arch_async:flush/2,
flush_extra =>
#{batch_name => insert_mam_messages30,batch_size => 30,
enabled => true,flush_interval => 1,pool_size => 16},
flush_interval => 1,pool_size => 16,pool_type => batch}]},
transient,false,infinity,supervisor,
[mongoose_async_pools]}}},
#{id => pm_mam_sup_async_pool_localhost,restart => transient,
start =>
{mongoose_async_pools,start_link,
[<<"localhost">>,pm_mam,
#{batch_name => insert_mam_messages30,batch_size => 30,
enabled => true,
flush_callback => fun mod_mam_rdbms_arch_async:flush/2,
flush_extra =>
#{batch_name => insert_mam_messages30,batch_size => 30,
enabled => true,flush_interval => 1,pool_size => 16},
flush_interval => 1,pool_size => 16,pool_type => batch}]},
type => supervisor}},
... pgsql_mnesia_25 / pgsql_mnesia / 5701808 mssql_mnesia_25 / odbc_mssql_mnesia / 5701808 riak_mnesia_24 / riak_mnesia / 5701808 mysql_redis_25 / mysql_redis / 5701808 |
5701808
to
5820056
Compare
small_tests_24 / small_tests / 5820056 small_tests_25 / small_tests / 5820056 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 5820056 ldap_mnesia_24 / ldap_mnesia / 5820056 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 5820056 ldap_mnesia_25 / ldap_mnesia / 5820056 dynamic_domains_mysql_redis_25 / mysql_redis / 5820056 pgsql_mnesia_24 / pgsql_mnesia / 5820056 pubsub_SUITE:tree+node_config:send_last_published_item_test{error,{{badmatch,false},
[{pubsub_tools,check_response,2,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,491}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,481}]},
{pubsub_tools,receive_subscribe_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,334}]},
{pubsub_SUITE,'-send_last_published_item_test/1-fun-0-',2,
[{file,"/home/circleci/project/big_tests/tests/pubsub_SUITE.erl"},
{line,937}]},
{escalus_story,story,4,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,72}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1292}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1224}]}]}} dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 5820056 internal_mnesia_25 / internal_mnesia / 5820056 pgsql_mnesia_25 / pgsql_mnesia / 5820056 mysql_redis_25 / mysql_redis / 5820056 riak_mnesia_24 / riak_mnesia / 5820056 mssql_mnesia_25 / odbc_mssql_mnesia / 5820056 push_integration_SUITE:pubsub_ful:pm_notifications_with_inbox:inbox_msg_unread_count_fcm{error,
{{assertMatch,
[{module,push_integration_SUITE},
{line,662},
{expression,"Data"},
{pattern,"# { << \"message-count\" >> := ExpectedCount }"},
{value,
#{<<"last-message-body">> => <<"Private message">>,
<<"last-message-sender">> =>
<<"alice_inbox_msg_unread_count_fcm_2515@localhost">>,
<<"message-count">> => 1}}]},
[{push_integration_SUITE,check_notification,2,
[{file,
"/home/circleci/project/big_tests/tests/push_integration_SUITE.erl"},
{line,662}]},
{push_integration_SUITE,'-inbox_msg_unread_count/3-fun-0-',6,
[{file,
"/home/circleci/project/big_tests/tests/push_integration_SUITE.erl"},
{line,578}]},
{escalus_story,story,4,
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,72}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} |
Also: - Print usage for the new format, marking the old commands as deprecated. - Gather category and command descriptions using introspection. - Rework error messages to process the context directly, making the code more concise. - Reuse the usage printing logic for category- and command-related help. It doesn't make sense to rewrite it as support for both command formats (old and new) is temporary. This can be rewritten when the odl format is dropped.
The new format is '--name value' instead of JSON. JSON is used only for complex values i.e. input objects and lists.
Also: messages have changed, so they are updated.
5820056
to
42c2401
Compare
small_tests_24 / small_tests / 42c2401 small_tests_25 / small_tests / 42c2401 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 42c2401 ldap_mnesia_24 / ldap_mnesia / 42c2401 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 42c2401 dynamic_domains_mysql_redis_25 / mysql_redis / 42c2401 ldap_mnesia_25 / ldap_mnesia / 42c2401 pgsql_mnesia_24 / pgsql_mnesia / 42c2401 dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 42c2401 internal_mnesia_25 / internal_mnesia / 42c2401 elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 42c2401 pgsql_mnesia_25 / pgsql_mnesia / 42c2401 mysql_redis_25 / mysql_redis / 42c2401 mssql_mnesia_25 / odbc_mssql_mnesia / 42c2401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There are two main goals of this PR:
1. Change the argument format
The previous argument format for the GraphQL-based CLI was always JSON, which a bit difficult to use. For example, this is how you would ask for the number of users in a domain:
This is how you do it after the change:
Strings and integers are automatically processed, so they don't need quoting (unless the string has special characters or spaces).
Arguments with complex types (lists, input objects) need to be passed as JSON.
2. Provide help for the new commands
The new commands are to replace the old ones, which used
admin_extra
.mongooseimctl
on its own displays a list of categories, basic commands (not categorized) and general help.mongooseimctl help
displays the old-style help with all deprecated commands, which are still supported.mongooseimctl categoryName
displays a list of commands with descriptions.mongooseimctl categoryName commandName --help
displays a list of arguments with descriptions.--help
is required for argument-less commands, because otherwise they would be executed. For other commands you can omit--help
.There is more information displayed, please try it for yourself. Some examples are shown below, but the formatting is better in the shell.
mongooseimctl
mongooseimctl account
mongooseimctl account listUsers