// run_aot.ce — compile a .ce program to native dylib and run it
//
// Usage:
//   cell run_aot <program.ce>

var shop = use('internal/shop')
var fd = use('fd')

if (length(args) < 1) {
  log.compile('usage: cell run_aot <program.ce>')
  return
}

var file = args[0]
if (!fd.is_file(file)) {
  if (!ends_with(file, '.ce') && fd.is_file(file + '.ce'))
    file = file + '.ce'
  else {
    log.error('file not found: ' + file)
    return
  }
}

var abs = fd.realpath(file)
shop.use_native(abs)
