// Path: payload_reader/src/main/java/com/meituan/android/walle/ChannelInfo.java
// public class ChannelInfo {
//     private final String channel;
//     private final Map<String, String> extraInfo;
// 
//     public ChannelInfo(final String channel, final Map<String, String> extraInfo) {
//         this.channel = channel;
//         this.extraInfo = extraInfo;
//     }
// 
//     public String getChannel() {
//         return channel;
//     }
// 
//     public Map<String, String> getExtraInfo() {
//         return extraInfo;
//     }
// }
// 
// Path: payload_reader/src/main/java/com/meituan/android/walle/ChannelReader.java
// public final class ChannelReader {
//     public static final String CHANNEL_KEY = "channel";
// 
//     private ChannelReader() {
//         super();
//     }
// 
//     /**
//      * easy api for get channel & extra info.<br/>
//      *
//      * @param apkFile apk file
//      * @return null if not found
//      */
//     public static ChannelInfo get(final File apkFile) {
//         final Map<String, String> result = getMap(apkFile);
//         if (result == null) {
//             return null;
//         }
//         final String channel = result.get(CHANNEL_KEY);
//         result.remove(CHANNEL_KEY);
//         return new ChannelInfo(channel, result);
//     }
// 
//     /**
//      * get channel & extra info by map, use {@link ChannelReader#CHANNEL_KEY PayloadReader.CHANNEL_KEY} get channel
//      *
//      * @param apkFile apk file
//      * @return null if not found
//      */
//     public static Map<String, String> getMap(final File apkFile) {
//         try {
//             final String rawString = getRaw(apkFile);
//             if (rawString == null) {
//                 return null;
//             }
//             final JSONObject jsonObject = new JSONObject(rawString);
//             final Iterator keys = jsonObject.keys();
//             final Map<String, String> result = new HashMap<String, String>();
//             while (keys.hasNext()) {
//                 final String key = keys.next().toString();
//                 result.put(key, jsonObject.getString(key));
//             }
//             return result;
//         } catch (JSONException e) {
//             e.printStackTrace();
//         }
//         return null;
//     }
// 
//     /**
//      * get raw string from channel id
//      *
//      * @param apkFile apk file
//      * @return null if not found
//      */
//     public static String getRaw(final File apkFile) {
//         return  PayloadReader.getString(apkFile, ApkUtil.APK_CHANNEL_BLOCK_ID);
//     }
// }
// 
// Path: walle-cli/src/main/java/com/meituan/android/walle/utils/Fun1.java
// public interface Fun1<T, R> {
//     R apply(T v);
// }


import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.converters.FileConverter;
import com.meituan.android.walle.ChannelInfo;
import com.meituan.android.walle.ChannelReader;
import com.meituan.android.walle.utils.Fun1;
import java.io.File;
import java.util.List;
import java.util.Map;
package com.meituan.android.walle.commands;




@Parameters(commandDescription = "get channel info from apk and show all by default")
public class ShowCommand implements IWalleCommand {

    @Parameter(required = true, description = "file1 file2 file3 ...", converter = FileConverter.class, variableArity = true)
    private List<File> files;

    @Parameter(names = {"-e", "--extraInfo"}, description = "get channel extra info")
    private boolean showExtraInfo;

    @Parameter(names = {"-c", "--channel"}, description = "get channel")
    private boolean shoChannel;

    @Parameter(names = {"-r", "--raw"}, description = "get raw string from Channel id")
    private boolean showRaw;

    @Override
    public void parse() {
        if (showRaw) {
// Path: payload_reader/src/main/java/com/meituan/android/walle/ChannelInfo.java
// public class ChannelInfo {
//     private final String channel;
//     private final Map<String, String> extraInfo;
// 
//     public ChannelInfo(final String channel, final Map<String, String> extraInfo) {
//         this.channel = channel;
//         this.extraInfo = extraInfo;
//     }
// 
//     public String getChannel() {
//         return channel;
//     }
// 
//     public Map<String, String> getExtraInfo() {
//         return extraInfo;
//     }
// }
// 
// Path: payload_reader/src/main/java/com/meituan/android/walle/ChannelReader.java
// public final class ChannelReader {
//     public static final String CHANNEL_KEY = "channel";
// 
//     private ChannelReader() {
//         super();
//     }
// 
//     /**
//      * easy api for get channel & extra info.<br/>
//      *
//      * @param apkFile apk file
//      * @return null if not found
//      */
//     public static ChannelInfo get(final File apkFile) {
//         final Map<String, String> result = getMap(apkFile);
//         if (result == null) {
//             return null;
//         }
//         final String channel = result.get(CHANNEL_KEY);
//         result.remove(CHANNEL_KEY);
//         return new ChannelInfo(channel, result);
//     }
// 
//     /**
//      * get channel & extra info by map, use {@link ChannelReader#CHANNEL_KEY PayloadReader.CHANNEL_KEY} get channel
//      *
//      * @param apkFile apk file
//      * @return null if not found
//      */
//     public static Map<String, String> getMap(final File apkFile) {
//         try {
//             final String rawString = getRaw(apkFile);
//             if (rawString == null) {
//                 return null;
//             }
//             final JSONObject jsonObject = new JSONObject(rawString);
//             final Iterator keys = jsonObject.keys();
//             final Map<String, String> result = new HashMap<String, String>();
//             while (keys.hasNext()) {
//                 final String key = keys.next().toString();
//                 result.put(key, jsonObject.getString(key));
//             }
//             return result;
//         } catch (JSONException e) {
//             e.printStackTrace();
//         }
//         return null;
//     }
// 
//     /**
//      * get raw string from channel id
//      *
//      * @param apkFile apk file
//      * @return null if not found
//      */
//     public static String getRaw(final File apkFile) {
//         return  PayloadReader.getString(apkFile, ApkUtil.APK_CHANNEL_BLOCK_ID);
//     }
// }
// 
// Path: walle-cli/src/main/java/com/meituan/android/walle/utils/Fun1.java
// public interface Fun1<T, R> {
//     R apply(T v);
// }


// Path: walle-cli/src/main/java/com/meituan/android/walle/commands/ShowCommand.java
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.converters.FileConverter;
import com.meituan.android.walle.ChannelInfo;
import com.meituan.android.walle.ChannelReader;
import com.meituan.android.walle.utils.Fun1;
import java.io.File;
import java.util.List;
import java.util.Map;

package com.meituan.android.walle.commands;




@Parameters(commandDescription = "get channel info from apk and show all by default")
public class ShowCommand implements IWalleCommand {

    @Parameter(required = true, description = "file1 file2 file3 ...", converter = FileConverter.class, variableArity = true)
    private List<File> files;

    @Parameter(names = {"-e", "--extraInfo"}, description = "get channel extra info")
    private boolean showExtraInfo;

    @Parameter(names = {"-c", "--channel"}, description = "get channel")
    private boolean shoChannel;

    @Parameter(names = {"-r", "--raw"}, description = "get raw string from Channel id")
    private boolean showRaw;

    @Override
    public void parse() {
        if (showRaw) {
            printInfo(new Fun1<File, String>() {