@@ -10,11 +10,7 @@ commit_subcommand::commit_subcommand(const libgit2_object&, CLI::App& app)
1010{
1111 auto *sub = app.add_subcommand (" commit" , " Record changes to the repository" );
1212
13- // TODO: merge the following option and flag into: sub->add_option("-m,--message", m_commit_message, "Commit message")
14- // when we have a solution to ask for a message when not using the -m flag.
15- sub->add_option (" commit_message" , m_commit_message, " Commit message" );
16-
17- sub->add_flag (" -m,--message" , m_commit_message_flag, " " );
13+ sub->add_option (" -m,--message" , m_commit_message, " Commit message" );
1814
1915 sub->callback ([this ]() { this ->run (); });
2016};
@@ -27,13 +23,14 @@ void commit_subcommand::run()
2723 auto repo = repository_wrapper::init (directory, bare);
2824 auto author_committer_signatures = signature_wrapper::get_default_signature_from_env (repo);
2925
30- if (!m_commit_message_flag)
31- {
32- throw std::runtime_error (" Please provide a message using the -m flag." );
33- }
3426 if (m_commit_message.empty ())
3527 {
36- throw std::runtime_error (" Please provide a commit message." );
28+ std::cout << " Please enter a commit message: " << std::endl;
29+ std::getline (std::cin, m_commit_message);
30+ if (m_commit_message.empty ())
31+ {
32+ throw std::runtime_error (" Aborting, no commit message specified." );
33+ }
3734 }
3835
3936 repo.create_commit (author_committer_signatures, m_commit_message);
0 commit comments