var command = {
  command: "opcode",
  description: "Print the compiled opcodes for a given contract",
  builder: {
    all: {
      type: "boolean",
      default: false
    }
  },
  help: {
    usage: "truffle opcode <contract_name>",
    options: [
      {
        option: "<contract_name>",
        description:
          "Name of the contract to print opcodes for. Must be a contract name, not a file name. (required)"
      }
    ]
  },
  run: function (options, done) {
    var Config = require("@truffle/config");
    var TruffleError = require("@truffle/error");
    var Contracts = require("@truffle/workflow-compile");
    var CodeUtils = require("@truffle/code-utils");

    if (options._.length === 0) {
      return done(new TruffleError("Please specify a contract name."));
    }

    var config = Config.detect(options);
    Contracts.compileAndSave(config, function (err) {
      if (err) return done(err);

      var contractName = options._[0];
      var Contract;
      try {
        Contract = config.resolver.require(contractName);
      } catch (e) {
        return done(
          new TruffleError(
            'Cannot find compiled contract with name "' + contractName + '"'
          )
        );
      }

      var bytecode = Contract.deployedBytecode;
      var numInstructions = Contract.deployedSourceMap.split(";").length;

      if (options.creation) {
        bytecode = Contract.bytecode;
        numInstructions = Contract.sourceMap.split(";").length;
      }

      var opcodes = CodeUtils.parseCode(bytecode, numInstructions);

      var indexLength = (opcodes.length + "").length;

      opcodes.forEach(function (opcode, index) {
        var strIndex = index + ":";

        while (strIndex.length < indexLength + 1) {
          strIndex += " ";
        }

        console.log(
          strIndex + " " + opcode.name + " " + (opcode.pushData || "")
        );
      });
    });
  }
};

module.exports = command;

@@ -1,11 +1,13 @@
-var
+const
  command
@@ -472,27 +472,29 @@
 done) %7B%0A    
-var
+const
  Config = re
@@ -523,19 +523,21 @@
 %22);%0A    
-var
+const
  Truffle
@@ -571,27 +571,29 @@
 rror%22);%0A    
-var
+const
  Contracts =
@@ -635,19 +635,21 @@
 %22);%0A    
-var
+const
  CodeUti
@@ -879,70 +879,43 @@
 nfig
-, function (err) %7B%0A      if (err) return done(err);%0A%0A
+)%0A      .then(() =%3E %7B%0A  
       
-var
+const
  con
@@ -946,19 +946,21 @@
 ;%0A      
-var
+  let
  Contrac
@@ -972,14 +972,18 @@
     
+  
 try %7B%0A
+  
     
@@ -1042,16 +1042,18 @@
 ;%0A      
+ 
+ 
 %7D catch 
@@ -1054,24 +1054,26 @@
 catch (e) %7B%0A
+  
         retu
@@ -1091,16 +1091,18 @@
         
+  
 new Truf
@@ -1123,16 +1123,18 @@
         
+ 
+ 
 'Cannot 
@@ -1200,18 +1200,22 @@
         
-)%0A
+  )%0A  
         
@@ -1215,32 +1215,34 @@
        );%0A      
+  
 %7D%0A%0A      var byt
@@ -1234,19 +1234,21 @@
 %0A%0A      
+ 
-var
+ let
  bytecod
@@ -1284,19 +1284,21 @@
 ;%0A      
-var
+  let
  numInst
@@ -1357,24 +1357,26 @@
 gth;%0A%0A      
+  
 if (options.
@@ -1383,24 +1383,26 @@
 creation) %7B%0A
+  
         byte
@@ -1435,16 +1435,18 @@
         
+ 
+ 
 numInstr
@@ -1503,20 +1503,25 @@
     
+  
 %7D
-%0A
 %0A      
-var
+  const
  opc
@@ -1582,19 +1582,23 @@
 %0A%0A      
-var
+  const
  indexLe
@@ -1641,16 +1641,18 @@
 %0A%0A      
+  
 opcodes.
@@ -1659,25 +1659,16 @@
 forEach(
-function 
 (opcode,
@@ -1674,16 +1674,19 @@
 , index)
+ =%3E
  %7B%0A     
@@ -1688,19 +1688,21 @@
         
-var
+  let
  strInde
@@ -1719,16 +1719,18 @@
 + %22:%22;%0A%0A
+  
         
@@ -1775,32 +1775,34 @@
  1) %7B%0A          
+  
 strIndex += %22 %22;
@@ -1802,35 +1802,39 @@
 += %22 %22;%0A        
+  
 %7D%0A%0A
+  
         console.
@@ -1840,32 +1840,34 @@
 .log(%0A          
+  
 strIndex + %22 %22 +
@@ -1915,27 +1915,31 @@
 %22%22)%0A        
+  
 );%0A
+  
       %7D);%0A  
@@ -1936,25 +1936,46 @@
     %7D);%0A    
-%7D
+  %7D)%0A      .catch(done
 );%0A  %7D%0A%7D;%0A%0Am

Correct mistake in calling compileAndSave with a callback