<commit_before>require! bluebird: {coroutine: async}: Promise
require! 'readline-sync'
require! '../api/check-base-url'
require! '../config'
require! chalk: {bold}
require! '../utils': {die}
require! ramda: {bind}

write = bind process.stdout.write, process.stdout

module.exports = async ->*
  """
  Enter jenkins base url (abort with ^C)
  Base url is the url of jenkins' main view
  """ |> console.log

  base-url = readline-sync.prompt!

  write 'Checking URL..'
  interval = set-interval (-> write '.'), 200

  check-base-url base-url
    .tap -> clear-interval interval
    .then ->
      it.cata do
        Just: ->
          write bold.green ' OK!\n'

          """
          Configuration written to #{config.path}
          Ready to go!
          """ |> console.log
        Nothing: ->
          write '\n'
          die "Error: Could not find jenkins API in the given URL"

    .catch ->
      write '\n'
      die it<commit_msg>setup: actually save the url<commit_after>require! bluebird: {coroutine: async}: Promise
require! 'readline-sync'
require! '../api/check-base-url'
require! '../config'
require! chalk: {bold}
require! '../utils': {die}
require! ramda: {bind}

write = bind process.stdout.write, process.stdout

module.exports = async ->*
  """
  Enter jenkins base url (abort with ^C)
  Base url is the url of jenkins' main view
  """ |> console.log

  base-url = readline-sync.prompt!

  write 'Checking URL..'
  interval = set-interval (-> write '.'), 200

  check-base-url base-url
    .tap -> clear-interval interval
    .then ->
      it.cata do
        Just: ->
          write bold.green ' OK!\n'
          config.save base-url

          """
          Configuration written to #{config.path}
          Ready to go!
          """ |> console.log
        Nothing: ->
          write '\n'
          die "Error: Could not find jenkins API in the given URL"

    .catch ->
      write '\n'
      die it
{'fraction_non_alphanumeric': 0.14174454828660435, 'fraction_numerical': 0.003115264797507788, 'mean_word_length': 2.1746293245469523, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1019901', 'n_tokens_mistral': 616, 'n_tokens_neox': 595, 'n_words': 187}